Regex not working inside of selector

Hello Everyone,
Here’s the selector i created:

<wnd app='msedge.exe' cls='Chrome_WidgetWin_1' title='Invoice-*.pdf and 1 more page - Work - Microsoft​ Edge' />
<ctrl name='Invoice-*.pdf' role='document' />
<ctrl name='PDF document containing 1 page' role='document' />
<ctrl name='Page 1' role='pane' />
<ctrl role='grouping' text='(Date:|Vendor:|Tax ID:)' matching:text='regex' />

Now I’ve tested this regex against the text that it is supposed to recognize using an online site.
This is the content of the text field:

Tax ID: RO657483 Vendor: Clipboard Papers Date: 2017-11-18

Basically I want to recognize this text area based on whether it contains at least one of those alternatives…

Basically, i have to process several invoices, some of whitch may not have the tax id or the vendor, so i want the selector to work even in those cases. Am I completely off road?

Can you tell me why it isn’t working? am I missing something?

welcome to the forum

check back your post we cannot see the selector. Please use for code snippets the </> format button from editor. thanks

@ppr yes,i updated the topic

just ensure that following is not blocking as maybe more pages are in the test pdf:

<ctrl name='PDF document containing 1 page' role='document' />
<ctrl name='Page 1' role='pane' />

otherwise, reduce the regex to a single case and redevelop it again step by step for analysis purposes.

Feel free to share additional screenshots from UIExplorer/Visuals with us

the thing is, it is not even working with the initial invoice i created it from… i’ll see what i can do


Can you try the following pattern?

<ctrl role='grouping' text='.*?Tax ID:.*?Vendor:.*?Date:.*?' matching:text='regex' />

If all the items doesn’t always exists, the following might work.

<ctrl role='grouping' text='.*?(Date:|Vendor:|Tax ID:).*?' matching:text='regex' />


Yes they don’t always exist, I’ve been thinking about this and I think that this might also work:
(.Date:.|.Vendor:.|.Tax ID:.)

I tried your regex but it still doesn’t work… is it possible that the element will be found even if the validate button is red?


Unfortunately, no. If possible, Can you share actual selector of the target element?

Or if there is possibilty the selector string contains linebreak, the following might be better.

<ctrl role='grouping' text='[\s\S]*?(Date:|Vendor:|Tax ID:)[\s\S]*?' matching:text='regex' />


Yes!!! that was it, I was under the false impression that . symbol was a substitute for everything, but it doesn’t cover special line break characters!
One more thing, what if the line breaks are not always there? is (.*|\s*) gonna be enough to cover for that?


. means any character except linebreak(chr(10)). So if it contains linebreak, we need to take care for it.

what if the line breaks are not always there?

The above regex selector will work even if there is no linebreak.


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