Hi all
Newbie to regex so would really appreciate some help.
I am retrieving a large string from the database and before outputting anything to the browser, I am looking to see if a certain substring or pattern exists in the large string itself so I can store it to a variable and later manipulate it.
The string pattern I am looking for is:
<%RG
Now, this string would normally be something like:
<%RG_1_4> or <%RG_2_3> where the rest of the characters before the last greater than symbol (>) are different each time.
I need to be able to detect the string <%RG and then store it, and all characters up to the last > symbol into a variable.
so basically look for <%RG?_?> where question marks are a range of numbers numbers and store it to a variable.
Is Regex the way to achieve this and if so, can someone help and provide code on how to do it?
Many Thanks and I hope I have made sense!