Sample text - ☐9:00 A.M. – 10:00 A.M. ☐10:00 A.M. – 11:00 A.M. ☒11:00 A.M. – 12:00 P.M. ☐12:00 P.M. – 1:00 P.M.
Expected - 11:00 A.M. – 12:00 P.M.
Note i want to extract time span next to ☒ this sign
Sample text - ☐9:00 A.M. – 10:00 A.M. ☐10:00 A.M. – 11:00 A.M. ☒11:00 A.M. – 12:00 P.M. ☐12:00 P.M. – 1:00 P.M.
Expected - 11:00 A.M. – 12:00 P.M.
Note i want to extract time span next to ☒ this sign
Hi @pravin_bindage ,
Maybe you could try with the below regex :
(?<=☒).*(?=☐)
Expression :
Regex.Match(yourString,"(?<=☒).*(?=☐)").Value.Trim
[CheatSheet] - System.Text.RegularExpressions | RegEx - News / Tutorials - UiPath Community Forum
whenever we can rely on
☒
then we can anchor as mentioned above e.g. by Arpan
I m reading word file & extracting text from that string . I get index was outside bounds of array @supermanPunch @ppr
Patient Registration Form_Sample1.docx (4.8 MB)
Let us know if this error happens in reading the file and not when performing the regex operation as mentioned above. I do not think we would get that Error from the above Regex Match operation.
Let us know which activity or step gives out the error and maybe we can move that discussion to a different topic.
I m using this synntax to extract First name -
System.Text.RegularExpressions.Regex.Split(str,“\n”)(9)
I get this error for assign activity
As suggested, It looks like a different requirement, We can help you out on this in a Separate Topic.
Mention your requirements (Capturing First Name), Input and Expected Output, So we can help you in that specific topic.
Created new post
Results like this -
11:00 A.M. – 12:00 P.M. ☐12:00 P.M. – 1:00 P.M.☐1:00 P.M. – 2:00 P.M. ☐2:00 P.M. – 3:00 P.M. ☒3:00 P.M. – 4:00 P.M. ☐4:00 P.M. – 5:00 P.M.
I want only - 11:00 A.M. – 12:00 P.M.
I believe the Output for this data should be 3.00 PM. - 4:00 P.M. as the ☒ is present before 3 PM
What if In case of “☒” this sign is at last time span
☐9:00 A.M. – 10:00 A.M. ☐10:00 A.M. – 11:00 A.M. ☐11:00 A.M. – 12:00 P.M. ☐12:00 P.M. – 1:00 P.M.
☐1:00 P.M. – 2:00 P.M. ☐2:00 P.M. – 3:00 P.M. ☐3:00 P.M. – 4:00 P.M. ☐4:00 P.M. – 5:00 P.M. ☒5:00 P.M. – 6:00 P.M.
Hi @pravin_bindage ,
It will work for both the conditions as per below screenshot,
Regular Expression:
(?<=☒)\d{1,2}:\d{1,2}\s+[A-z.]+\s+.\s+\d{1,2}:\d{1,2}\s+[A-z.]+
Hope this helps
Yes. The regex expression provided earlier doesn’t get the data if there isn’t an Empty Box at the end as well.
So you could go ahead with the suggestion provided by @Manish540 in the above post.
Or Maybe with the below more specific regex expression :
(?<=☒)\d+:\d+\s(A|P)\.M\.\s.\s\d+:\d+\s(A|P)\.M\.