Hi
*** Q (without M2) = 0.81 CONDITIONALLY ACCEPTED.
I want to extract all the words after the number 0.81 which varies for every .txt file.
I tried the below but it doesn’t work
(System.Text.RegularExpressions.Regex.Match(Text1,“(?<=(without M2)).+”).Value).ToString.Split(“\d+”.ToCharArray).last
1 Like
lakshman
(Ganta lakshman)
February 11, 2020, 2:58am
2
@Anonymous2
Try below regular expression to get required value from above string.
(?<=\d.\d{2}\s).+
lakshman:
\d.\d{2}\s
Hi
Thanks for the reply. We need (without M2) to identify the line, so we can’t use
(?<=\d.\d{2}\s).+
I tried the below but I get the error that there are too many s. So how should I solve the problem? Thanks
(System.Text.RegularExpressions.Regex.Match(Text1,“(?<=(without M2)\s+=\s+\d+.\d+)).+”).Value)
Manish540
(Manish Shettigar)
February 11, 2020, 3:53am
4
Can you send some sample lines, how it looks?
hasib08
(Motiwala Hasib)
February 11, 2020, 3:59am
5
Checking the String (without M2) and getting the String after the digit in Group 1.
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
Thanks
@Anonymous2
Manish540 Robot Master
8m
Can you send some sample lines, how it looks?
====================
Hi
Thank for the reply. The sample line is
*** Q (without M2) = 0.81 CONDITIONALLY ACCEPTED.
The number 0.81 varies for every .txt file. There are a lot of other lines in my .txt file, so I need (without M2) to identify the above line.
Thank you
Manish540
(Manish Shettigar)
February 11, 2020, 4:02am
7
Check with this regex,
(?<=without M2).+(?<=\d.)(\w.*)
1 Like
Hi
It doesn’t work. I get back
) = 0.81 CONDITIONALLY ACCEPTED.
indra
(Indra)
February 11, 2020, 4:12am
9
@Anonymous2 Try this and let me know
Regex
Result
Manish540
(Manish Shettigar)
February 11, 2020, 4:14am
10
Use Group(1) , you will get it.
1 Like
Manish540
(Manish Shettigar)
February 11, 2020, 4:22am
11
Do as below screenshot,
Use below code you will get the match collection,
System.Text.RegularExpressions.Regex.Matches( Str,“(?<=without M2).+(?<=\d.)(\w.*)”)
Then, pass this match collection to “for each” and use “item.Groups(1)”.
And in properties panel of for each make "TypeArgument " of match.
Hi Indra
Thanks for the comprehensive explanation. But as said I need (without M2) to identify the line, which your solution lacks.
Hi Manish540,
I used the below, and managed to extract the “1 CONDITIONALLY ACCEPTED”. Any idea to get rid of the digit? Thanks
(System.Text.RegularExpressions.Regex.Match(Text1,“(?<=(without M2).+\d+.\d+).*”).Value)
Hi All
I managed to solve it with
(System.Text.RegularExpressions.Regex.Match(Text1,“(?<=(without M2).+\d+.\d+\s+).*”).Value)
Thanks everyone for your kind help!
1 Like