Quantcast
Channel: Regular Expression - Formatting text in a block - IM - Stack Overflow
Browsing latest articles
Browse All 4 View Live

Answer by MikeM for Regular Expression - Formatting text in a block - IM

I recommend that you remove the inner negative look-aheads from your negative look-aheads:/(?!(?!.*?<a)[^<]*<\/a>)_it_/.test( ' _it_ <a></a>' ); // true...

View Article



Answer by MikeM for Regular Expression - Formatting text in a block - IM

The following shouldn't create incorrectly nested spans var old;var rx = /(?![^<]*(?:>|<\/a>))([!*_-])((?!\1)[^<>\s][^<>]*?)\1/g;while ( old != str ) { old = str; str =...

View Article

Answer by talemyn for Regular Expression - Formatting text in a block - IM

Try these:var boldPattern = /\*([^\s][^\*]*)\*/gi;var italicsPattern = /_([^\s][^_]*)_/gi;var strikethroughPattern = /-([^\s][^-]*)-/gi;var underlinePattern = /!([^\s][^!]*)!/gi;Though, in the replace,...

View Article

Regular Expression - Formatting text in a block - IM

Hello I am trying to figure out a regular expression to replace text in an innerHTML block to provide local formatting for text similar in operation to Google IM.Where:...

View Article
Browsing latest articles
Browse All 4 View Live




Latest Images