I want to fetch the bold text between the line break on the first row and a previously identified variable on the second row. The first row of text differs from time to time, that’s why I want to use the line break as a seperator.
How can I code this with regex? I know that you have to do something like the example below but how do you handle line breaks in such an expression? Can you use /n?
@Karthick_Settu
Thanks for your response.
The .* means that the first row always have to end with a dot right?
That is the problem, sometimes it’s “.” and sometime it’s “:” “,” or nothing at all.
That is why I am wondering about the line break separator.
Thank you, I was not aware of that. The line you provided worked for one of the cases, but when I put the variable name within + operator it worked for 3 out of 4 cases.
Like this:
System.Text.RegularExpressions.Regex.Match(text,“(.).(?= “+variableName+”)”).Value
The case where it didn’t work was when the String looked like this:
"Some text,
Some text. Some text variableName"
The output in this case became the text in the first line instead of the bold text.
This suggestion was great! I realised that I had misplaced another activity in a different part of my project. But now this line with ".* " is working. Thank you so much for your effort in the matter!