May I know how could I do if I only want to extract the first value after total?
The data is something similar like this:
Total 123 456 789
(I only want to get 123)
It works when I use the below code to get 789, but I do not know how to get 123.
(System.Text.RegularExpressions.Regex.Match(Text1,“(?<=Total ).+”).Value).ToString.Split(" "C).last
Do you mind to explain on what does this (?<=Total\s*)\S+?(?=\s) part of expression means?
(?<=Total\s*) is lookbehind of regex, it means “Total” and \s* (=any whitespaces) will be matched as lookbehind. (it will not be contained in the result)
\S+? means one or more NON-whitespaces and matched as result. (it might be good as \S+)
'(?=\s) is lookahead of regex, it means \s (=any white space) will be matched as lookahead. (it will not be contained in the result)