I have a string coming out as:
<span class="abc"> test </span> styletext
I want to grab just the styletext part which is dynamic and give it some css styles.
Can I use regex to select the whole part after the white space and apply the style? How do I target the part after the white space?
Try this as a regex:
You may need to escape the “\” depending on the language you are using.
The text captured in the group will be the style text.
It “translates” as: starting at the beginning of the string (
^) match the text “/span”, followed by any number of whitespace characters (\s*), followed by any number of any type of character (.*). The parenthesis tells it to capture the last part for later use.