Matches dosnt return value - regular expression

I have made the following matches acitivity, but it dosnt return the value shown in the picture.

Hey @eltmo sometimes the regex builder may not work. Please try regex using the assign activity.
It may help you.
Thanks and Regards.
Sreejith.

Hey!

Paste the input text here…

Will give you the regex…

Regards,
NaNi

test.txt (468 Bytes)

The acitivity works fine everywhere else?

Please try the below regex

“(?<=Lastname)[\s]+(.)*(?=()”

Replace the space and Navn value using the trim method and replace method.

I think u misunderstand, i did have a regular expression, that “works” but UiPath just dosnt return the value…

Can you try this regex using the assign activity instead of using the Regex Builder…

How do i do that? :slight_smile:

Hey!

Try this…

Replace:

Name = strinput.Replace(" ","")

RegEx:

System.Text.RegularExpressions.Regex.Match(Name,"(?<=nameNavn).*").ToString

RegEx Reference:

Regards,
NaNi

System.Text.RegularExpressions.Regex.Match(strInput,“(?<=Lastname)[\s]+(.)*(?=()”).tostring

try this way

If you still don’t understood then please try this workflow
Regex.xaml (5.3 KB)

Thanks and Regards.
Sreejith

it dosnt return anything

as an alternate
grafik
(?<=name.*?Navn)[\s\S]*?(?=\n)

@eltmo When i tried with the input string given by you it works fine.
so could you please try to put your exact input here or try to write your input into a text file using the bot and paste the text file again…
Thanks and Regards.
Sreejith…

Hey!

Have you checked the above updated post?\

Kindly try that one and let me know

Regards,
NaNi

hi there,

to make things easier, first you can develop a regex rule using https://regex-generator.olafneumann.org/

Second you can validate using https://regex101.com/

this makes sure you’re creating the right regex rules.

Apparently, UIpath wouldnt work with ) in the regex…

feel free to open a new topic on this
grafik

as we can work with ( in Regex within UiPath as it just about escping the brakets

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