• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Looking for some regex help (or other alternative)...

Kevin

Well-known member
#1
I'm working on a XF media site call back and am trying to extract a value. In the HTML that is being looked at there is one instance of a word followed by an equal sign followed by the numeric value I need followed by an ampersand or other non-numeric characters.

Any tips then on what to use extract the numeric value from "{string}myWord={numeric}{string}" when it appears in the midst an HTML page?

Thanks :)
 

Jake Bunce

XenForo moderator
Staff member
#2
I would like to see the original string to be certain instead of pattern matching a pattern, but...

#[a-zA-Z]+=([0-9]+)[a-zA-Z]+#siU

Ideally there should be more context in the pattern... so it is affixed with stuff before and after the part you are matching.
 

Kevin

Well-known member
#3
Thanks, Jake. I got it working and am happy with the results. It was the first media site callback I did from scratch so it was good learning lesson.