Regex extract aaname from UiElement

Hello!
Does anyone know how to fix this regex, and why it’s not capturing the first occurence of ’ char? I want to extract aaname
Pattern: (?<=‘).*(?=’)
I’m using regex101 page to test it.
Test string: webctrl aaname=‘ProductName’ tableRow=‘2’ tag=‘OPTION’

(?<=').*?(?=')

just to make it ungreedy. But we would recommend for other options e.g. attribute retrieval

2 Likes

@olgu,

Have you tried Get Attribute activity. This will give you the aaname more easily.

Thanks,
Ashok :slight_smile:

1 Like

try this regex:
image

If you need the matches to be without the quotes, just trim them:

myMatch.trim("'"c)

(that is a single quote between double quotes there)

1 Like

in addition to above: using an anchored Regex (also making it ungreedy)
A regular expression  is being tested on the string  to match the value of the "aaname" attribute. (Captioned by AI)

But still we recommend:

1 Like

Hi @olgu

try this

(?<=aaname\S\S).*(?=\S\stableRow)

image

Regards,
Gowtham K

1 Like

Thank you All, I was looping through collection of options of Select Item element, so that’s why I needed to use Regex. But ungreedy method works.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.