UiPath || Search pattern in Mainframe screen

Hello Team,
I need to find if value1 Y OR N date is present in mainframe screen. Here value 1 has some value , after few spaces Y or N will be there then after few spaces date will be there.

Please help me with regex or how we can achieve this.
Thank you

Hi @rutika.thawle

Try this

value1\s+[YN]\s+\d{1,2}/\d{1,2}/\d{4}

This would capture “value1,” “Y” or “N,” and the date separately.

can you share the sample input and expected output

@rutika.thawle

HI @rutika.thawle

I have taken the sample data like below if value1 as some value after that Y OR N After spaces date so this will matches the exactly one for your scenario

Try this regex expression for that

System.Text.RegularExpressions.Regex.IsMatch(input,"\b[0-9a-zA-Z]+\s{0,}[YN]\s{0,}[0-9\/\\\-.]+\b")

**Note :- it will matches the date having Y OR N then it will give as boolean as output**

image

1 Like

Hi Praveen , value1 is the string that I will pass in regex also the date. Also there are 11 spaces before Y/N and 3 spaces after Y/N. Shall it be like :
System.Text.RegularExpressions.Regex.IsMatch(input,“+str_value1+\s{0,}[YN]\s{0,}+str_Date”)
I am sorry I am newbie in regex.

@rutika.thawle

can u give a input clear

@rutika.thawle

Use this Regex

value1\s{11}(Y|N)\s{3}\d{2}/\d{2}/\d{4}

Cheers…!

date we dont need to mention u can put value2 instead .

I have mainframe screen scraped in string having multiple rows with records like
X1 Y 11/12/2023 CC1 DD EE
X2 N 11/12/2023 CC2 DD EE
X3 Y 02/12/2023 CC3 DD EE
X4 N 02/12/2023 CC4 DD EE
X5 Y 11/12/2023 CC5 DD EE

So this i have in string variable mainframescreen now .

variable value1 = X1
variable value2 = 11/12/2023
Now i want to check whether this mainframescreen string has value like :
value1 Y value2

here u can see there is space between value1 and Y . also there is space between Y and value2.
Please share the regex to match.

Hi @rutika.thawle

Try this

(?<=\d+\s+).*(?=\s+\d+)

image

for example your variable having the value 1 = X1,X2…SO on etc
and str_date = 11/12/2023 …so on , so it will match for your pattern like Y OR N

You can try this regex expression it will work for you and it will match the spaces between there are 11 spaces before Y/N and 3 spaces after Y/N. it will match

System.Text.RegularExpressions.Regex.IsMatch(input,"[A-Z0-9]{2}\s{0,}[Y|N]\s{0,}[0-9\\\/\-]+")

for reference you can see the output : -

@rutika.thawle