Regex Not Working But Match Activity Highlighting

Match Activity is Highlighting Value but its not giving value when i run it.

firstly you can give ouputvariable to match activity.
then used assign activity and for ex. str_Var1=matchactivityvariable(0).tostring
then you used message box and type your matchacivityvariale and its sure work and give you correct value.

@raja.arslankhan ,

Could you try changing the RegEx option to Advanced and check if you are able to get the value.

Also Perform a Debug and check if there are any values present in the Matches Activity Output variable.

HI @raja.arslankhan

Can you check by changing the option from Literal to advanced and try again once

Or

Add Multiline in the Regex option and check again
image

Regards
Sudharsan

Hello @raja.arslankhan
Try this

(?<=Availability[\n|\s]).*(?=%)

Try by Replace (\n|\s) with [\n|\s]

System.text.RegularExpressions.Regex.Match(YourString."(?<=Availability[\n|\s]).*(?=%)").Tostring.Trim

image

1 Like

@Sudharsan_Ka I applied all the option which you mentioned but its not working

Have you tried with expression too? @raja.arslankhan

System.Text.RegularExpressions.Regex.matches(InputString,"(?<=Availability\n|\s).*(?=%)")

Regards
Sudharsan

1 Like

@Sudharsan_Ka @Gokul_Jayakumar Guys Its Working in UiPath new version and both solutions you proposed I have tried… These are correct one but in UiPath Old version its not working.

@Sudharsan_Ka Can you explain this…it is returning something "collection of matches)

What version are you using? @raja.arslankhan

@Sudharsan_Ka 20.10.6

Yes you need to give Like
Expression(0)

System.Text.RegularExpressions.Regex.matches(InputString,"(?<=Availability\n|\s).*(?=%)")(0)

Or use this

System.Text.RegularExpressions.Regex.match(InputString,"(?<=Availability\n|\s).*(?=%)").Tostring

Regards
Sudharsan

@Sudharsan_Ka No way. Should I send you text file.

Yes please @raja.arslankhan

@Sudharsan_Ka please check this one.
pdftext.txt (1021 Bytes)

@Sudharsan_Ka I noticed When I am getting data from pdf …it is not working otherwise it is working

@raja.arslankhan ,

Check with the workflow again, there maybe a missed assignment or the correct variable not being used. This can be done by checking if there are duplicate variables created and also by checking in Debug mode by Step Into each of the activities and confirming the output received using the Debug Panels :

@supermanPunch brother I have 3 activities workflow where I am reading pdf and using that variable in matches activity and then log message

@raja.arslankhan

Can you please run in debug mode and from the locals panel can you show how the data is looking in the variable

Try this with single line or multiline option

(?<=Availability(\s)*).*(?=%)

Cheers

@Anil_G wao Amazing …Even I was going to change whole workflow

1 Like