get part with regex

Go To StackoverFlow.com

1

I need to get everything bewteen

onmouseout="this.style.backgroundColor='#fff'">

and the following <

in this case:

onmouseout="this.style.backgroundColor='#fff'">example<

I would like to get the word example. Here is a more complicated example of where it should work as well:

onmouseout="this.style.backgroundColor='#fff'">going to drink?<br></span><span title="Juist!" onmouseover="this.style.backgroundColor='#ebeff9'" onmouseout="this.style.backgroundColor='#fff'">Exactly!</span></span></div></div>

So here i need 2 of them back (and not joined).

Could someone help? I suck at regex.

Someone edited my tag to javascript. I need a solution to use in java, i just get a file as plain text. So javascript or html solutions are not really helpfull.

2012-04-03 21:15
by clankill3r
http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#173245 - James Montagne 2012-04-03 21:19


2

Regex with html? Well, If you have to parse only a few lines then ok. But in general is better to use a html parser (because HTML is not a regular language).

This is pure gold: https://stackoverflow.com/a/1732454/434171

2012-04-03 21:19
by Enrique Marcos
Ads