mk_89
mk_89

Reputation: 2742

regex which matches a word

I need to be able to match a price value from a string given the string starts with Shipping (UK):</span>

string

Shipping (UK):</span>&#163;2.95

regex so far

(?<=\):<\/span>).*

I have tried to do something like this...

(?<=\Shipping (UK):<\/span>).*

but this does not work, what is the right way to construct this regular expression?

Upvotes: 0

Views: 45

Answers (1)

nickb
nickb

Reputation: 59699

You need to escape the parenthesis in your current regex to get it to match:

(?<=Shipping \(UK\):<\/span>).*

Also, Charmander is correct, you don't want the shorthand \S, you want just S.

Upvotes: 2

Related Questions