~AA40% -~13,683.89
~FINALDATA
~PA RT#
This is the input from here i only want to extract FINALDATA as output, but im facing space issue between ~PA RT# and FINALDATA
I provided regex in matches as \S.+\n(?=(~PA RT#)),I have similar txt files,but all are reading FINALDATA in those txt files space is not there between FINALDATA nad ~PA RT#. Can anyone please help me to resolve this
Sanjit_Pal
(Sanjit Pal)
September 26, 2022, 10:44am
2
Chippy_Kolot:
\S.+\n(?=(~PA RT#))
Hello @Chippy_Kolot ,
You can do as per the below screenshot.
\S.+\n(?=(~PA RT#))|\S.+\n\n(?=(~PA RT#))
Thanks,
Sanjit
[A-Za-z ](FINALDATA)[A-Za-z ]
You can do something like this if your text is the same.
Hello
Take a look here.
Preview the pattern here.
Pattern:
[A-z\s]+(?=[\r\n]+~PA\s+RT)
Cheers
Steve
Gokul001
(Gokul Balaji)
September 26, 2022, 10:57am
6
Hi @Chippy_Kolot
You can try with Regex expression
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=\d\n~)(\S+)(\n\n~)(\S.+)")Groups(1)
Output : FINALSUM & FINALDATA
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=\d\n~)(\S+)(\n\n~)(\S.+)")Groups(3)
Output : DATA# & PA RT#
Hello @Chippy_Kolot
Kindly try this
(?<=~).*(?=\n\n~PA)
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=~).*(?=\n\n~PA)").ToString.Trim
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
Gokul001
(Gokul Balaji)
September 26, 2022, 12:16pm
8
Have you tried the above expression @Chippy_Kolot , Did you received correct output?
Let us know do you having any queries?
Regards
Gokul
system
(system)
Closed
September 29, 2022, 12:16pm
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.