I’m new to Regex and i need to parse sourcecode from a website. Can anyone tell me what would be the syntax to match a word followed by the next n characters in the string.
Let’s say I wanna match word “country” followed by the next 15 chars in the string.
If string would be “…<tr class=”hover”><td>country</td><td>RO</td></t……” I need to get “country</td><td>RO” , I can deal with the string like this , ideally would be only “country RO ” but I don’t wanna ask for too much.
Something like:
(country)<\/td><td>(\.\.)Using $1 $2 as your output should give you what you need.
Explaination:
With that assumption I would use something like:
(country)<\/td><td>([A-za-z]{2})Also helps to find a good reference: http://www.regular-expressions.info/reference.html