06-28-2021 09:13 AM
Hello,
Got stuck with Regex, may be some guidance could work.
*****************************************
LSBERT\sCHPAR\s1\sSTAT\r\nSTAT=NoDMSCheck\r\n>\s
***************************************
is the text and I need to start from Right to Left -
a) Have to exclude ">" and then only take the middle Line "STAT=NoDMSCheck"
The issues is the number of lines can change(2,3,4) and the text within those lines.
The only two consistent factors are
a. ">" at the end
b. I only take the second last line that is where my focus is.
Tried many Regex combinations bit looks like have lost my edge.
Thanks in advance.
Best,
Akshay
Solved! Go to Solution.
06-28-2021 09:48 AM
Maybe using a positive lookahead for that > like
.*(?=\r\n>)
That seemed to look for really simple test cases at least.
06-28-2021 09:53 AM
There may be different approaches, even without Regex.
For example (if I understood your needs), you can use Spreadsheet String to Array with %s as format: you get a 2D string array, extract the first column and check if the the last element is >\s. If yes, take the second last element.
06-28-2021 10:00 AM
thanks Jacobson,
that solves
I had a solution "(?<=\n)\\*[^\n\r]*" but yours elegant.