2013-10-02 34 views
0

我想知道什麼是該適當的正則表達式:如何使用正則表達式從特定的點到文本結束?

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. 

我要做到以下幾點:

給我其中的onmouseover =包含「LinkshimAsyncLin.swap標籤的字符串開始()在屬性區域中的任何位置..並與保持字符串的結尾結束..我從該標籤的意思是字符串的結尾

MY TRY: -

我用這個模式:

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

它成功地得到了這部分<a onmouseover="LinkshimAsyncLin.swap()> 我想也讓所有保留標記和文字到終點

注:

我的朋友,我知道,使用HTML標記的正則表達式是非常糟糕的做法,我已經有紅色,很多,但我希望特殊情況下

在此先感謝:)

+0

你還應該把你準確的預期匹配應該看起來像。用文字描述可能是不明確的。 – Derek

+0

好朋友..我想從頂部文本返回所有這一切(

回答

3

這是你想要的嗎?

onmouseover.* 
+0

只是你需要添加 Darka

+0

非常感謝你..它現在正在工作:) –

相關問題