CV element exist target text contains *****

i am using UiPath CV element exist,

i have a variable named UPhone_Number

and this is the descriptor i am using.

“Target: Text '” + Phone_Prefix + “*” + Phone_2_Suffix + “’ + (82,661,90,14)”

when i use the number +33333*****33 in the variable, the element that is detected is the first element on screen that starts with phone prefix

how can i match the number +33333*****33 with the exact target text on screen ?

Hello @Saccount,

Welcome to the community!

Try using regex
System.Text.RegularExpressions.Regex.Escape(UPhone_Number)

For +3333333, this becomes: +33333\33

Then:

  • In Target Text constraint:
    • Set Match Type = Regex
    • Use the escaped pattern
    • Ensure Match whole text is enabled (anchor with ^…$ if needed)

Example:
pattern = “^+33333*33$”

Hi @Saccount

If you only wanna use CV activities only, then I would suggest to use get CV text and fetch the phone number.

After fetching, match it to variable or a regex pattern per your requirement and then further steps for when a match is found.

in my scenario i need to fetsh it once, i have many numbers on screen and i need to click on a button relative to this number, and the screen is scrollable.

can you please show me what to type in the descriptor,
known that my project language is VB not C#

it works but it shows me

Invalid Descriptor
Reason: length (‘-7’) must be a non-negative value. (Parameter ‘length’)
Actual value was -7.
Descriptor value: 'Target: text ‘+111111’*****‘11’