我有這樣的樣本串,我想有一個開口,以取代明星和關閉使用JavaScript的正則表達式較強的觸殺:正則表達式替換字符的HTML標籤
To increase search results, use the 8** prefix.
877 and 866 will result in more matches than 800 and 888 prefixes.
*Note*: The pattern for a custom number can be more than 7 digits. For example: 1-800-Mat-tres(s)
理想的輸出將是:
To increase search results, use the 8** prefix.
877 and 866 will result in more matches than 800 and 888 prefixes.
<strong>Note</strong>: The pattern for a custom number can be more than 7 digits. For example: 1-800-Mat-tres(s)
唯一需要注意的是,如果連續有兩個開頭(如8 **),那麼它們不會被強標籤取代。
非常感謝您的幫助。
你有沒有在自己所有嘗試新鮮事物? – 2012-03-28 22:32:00
@AdamZalcman好點。我需要更多地鼓勵。 – Kyle 2012-03-28 22:40:28
是的,我試過 var thisContent = thisContent.replace(/\*(.*?)\*/ g,'$&'); – SkyOut 2012-03-29 13:38:36