cancel
Showing results for 
Search instead for 
Did you mean: 

REGEX for uppercase / lowercase value in Application Modeller

DeborahParfitt
Level 3
Hello Team

I have an application that has been upgraded where UI element ID was originally mixed case and now has been changed to upper case. As a result the objects no longer work.  I have been advised to a use a regular expression to pick up both mixed case and uppercase versions of the UI ID value to fix and future proof if the case changes again.

Can you advise how do I write a regular expression to pick up the following:-

Current value                Input Identifier txtAcctNbr
New value                     Input Identifier TXTACCTNBR

Many thanks

Debbie

------------------------------
Deborah Parfitt
RPA Developer
BNPParibas PF UK
Europe/London
------------------------------
9 REPLIES 9

Hi Deborah,

I believe the Input identifier value is the changing part. Either from the below should do the trick. The later would capture only alphabetical characters, and the former any word character. Feel free to use regex101.com to test it 😉

Input Identifier \w{10}
Input Identifier [a-zA-Z]{10}

Blue Prism does not deal well with regex flavours (like using 'i' for disabbling case sensitiveness), hence I did it as above.

------------------------------
Ramón Requena López
------------------------------

MarkStallard
Level 3
Hi Debbie -

A regex (regular expression) can be created to be case-insensitive, and I was hoping that the Application Modeler's Regex match type would be case-insensitive. Unfortunately, it is not. What you can do is define both the original mixed case element ID and it's all-uppercase variant in one regex expression, using the pipe symbol ( | ) to act as an "OR" operator (and don't use any blank spaces here):

    txtAcctNbr|TXTACCTNBR

In Regex match mode, that should match both instances. If someone later changes your target application UI to use all-lowercase element IDs, you'll need to update this regex again. You won't be able to cover all possible variations with one regex, because that would be 2^10 = 1024 variants. Again, it's unfortunate that the Regex match mode doesn't compile these regexes to ignore text case.

------------------------------
Mark Stallard
Software Developer
Raytheon Technologies
America/Boston, MA
------------------------------

1) In Blue Prism Params option you can not directly use RegEx. But instead, you can use UPPER function to ensure your ID always pass as an upper case.
e.g. i/p=txtAcctNbr then o/p=TXTACCTNBR. 
i/p=txtacctnbr then o/p=TXTACCTNBR. 
i/p=TXTACCTNbr then o/p=TXTACCTNBR. 

So this way the UPPER function will always convert your entire input string in UPPERCASE.

2) If you want to use RegEx then you need to add extra stages where you pass your input data, perform regex and then use output in Params box.


I feel the first option would be a simple fix and will work always if your UI element ID gonna be capital always.

Hope this helps.





------------------------------
Thanks & Regards,
Tejaskumar Darji
Sr. RPA Consultant-Automation Developer
------------------------------

Hi Tejaskumar

Are you referring to the Application Modeller. There is a RegEx option in the Match Type field. I don't know how to write a regular expression using .net?

31079.png
Many thanks

Debbie

------------------------------
Deborah Parfitt
RPA Developer
BNPParibas PF UK
Europe/London
------------------------------

Hello, see if this can help you.
Regex Class (System.Text.RegularExpressions) | Microsoft Docs
Whenever I need to use regex101.com to validate my regex

------------------------------
Emerson Ferreira
Sr Business Analyst
Avanade Brasil
+55 (081) 98886-9544
------------------------------
Sr Cons at Avanade Brazil

Hi Debbie,

Regex support can be hit and miss in Blue Prism (regardless whether the option is there for you or not).

I've made this quick regex which should achieve what you want (its dirty, but it will match)

^(t|T)(x|X)(t|T)(a|A)(c|C){0,2}(t|T)(n|N)(a|A)(m|M)(e|E)1$

A quick explanation as to what this does:
"^" - Start of the line/text to match
The brackets are a capture group, while we don't need a capture group necessarily, I've just used it so that it makes it slightly more readable.
Within the bracket we have a "|" symbol (known as a pipe), in regex this is basically an "or" statement. Lets take the first capture group as an example:
"(" - Start of the capture group
"t" - Match exactly lowercase "t"
"|" - Or
"T" - Match exactly uppercase "T"
")" - End of the capture group

In the braces ( "{" and "}" ) think of this like a repeat, so in this case:
"{" - start of "repeat"
"0" - Match at least "0" times
"2" - Match at most "2" times
"}" - end of "repeat"

And at the end:
"1" - Assuming that we want to match the number "1" at the end (and also assuming that there are multiple fields with the same "txtAcctName" label) we make sure that the end of the text is exactly the number "1"
"$" - Simply marks the end of a line. Used in this instance will mark the end of a string.

This regex can still be improved, but I'm not sure how compatible it will be with Blue Prism.

------------------------------
------------------------------
Jordan Harvey
------------------------------
------------------------------

Hi @DeborahParfitt,

I would suggest to use use Global Code Option in that object to find respective elements / UI ID using regEx and pass your web page html.
You can write once custom C#/ vb code which will have input as your page html (in code you can convert input html text to Upper / Lower and text or field which need to search and in that code you can use regEx to find to. while checking field always compare those fields either converting .ToUpper() or .ToLower() which will solve your case sensitive issue.

I use the same method to cope up with case sensitive issue.

Hope this will help you. I know this would be rework for you but it will be for single time.

Regards
Yogesh Soppa​

------------------------------
Yogesh Soppa
Sr. Application Developer
Allstate
------------------------------

ewilson
Staff
Staff
Hi @Deborah Parfitt,

Change the match type to .*(Reg Ex) and give this regex a try as the value:

(?i)(INSERT YOUR CONTROL ID HERE)

Ex. 
(?i)(txtAcctNbr)

Cheers,


------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------

@Deborah Parfitt -

I believe @ewilson has given the best solution so far, because it performs a case-insensitive submatch on your element ID (txtAcctNbr). You can also adapt this solution for the other UI elements in your target application.

I do see one small possibility where this regex could cause problems: If you have an element ID that is a substring of another ID. For example, Eric's regex:

     (?i)(txtAcctNbr)

Could match any of these IDs:

    txtAcctNbr
    txtAcctNbrSource
    lblTxtAcctNbr

If you run into such a problem, you could "anchor" the pattern to the beginning and end of the ID like this:

     ^(?i)(txtAcctNbr)$

Good luck with your automation!




------------------------------
Mark Stallard
Software Developer
Raytheon Technologies
Billerica, MA
United States
------------------------------