eng.ahmed
eng.ahmed

Reputation: 925

how use regex to get from specific point to end of text?

I want to know what is the proper regular expression for that :

In an action unprecedented during 12 years of war in Afghanistan, the commandant of the Marine Corps is firing two top generals. See why: 

<a onmouseover="LinkshimAsyncLin.swap()>Generals fired over Taliban attack </a><br/>security.blogs.cnn.com<br/>There were three investigations of the incident.

I want to do the following :

give me string starting of a tag which contains onmouseover="LinkshimAsyncLin.swap() in any position at properties area .. and end with the end of the remain string .. i mean from this a tag to end of the string

MY TRY :-

i used this pattern :

<a[^>]*?onmouseover\\s*=\\s*['\"]([^'\"]*?)['\"][^>]*?/?>

it got successfully this part <a onmouseover="LinkshimAsyncLin.swap()> i want to get also all remain tags and text to the end point

Note :

My friends, I know that using regex with html tag is very bad practice and i already have red that alot but i want that for special case

thank in advance :)

Upvotes: 0

Views: 116

Answers (1)

Derek
Derek

Reputation: 8763

Is this what you want?

onmouseover.*

Upvotes: 3

Related Questions