May
30

Steven Levithan has been flagrant by creating a simple way to remove nested patterns with a while loop and a replace: PLAIN TEXT JAVASCRIPT: var str = “abc&lt;1&lt;2<>3>4>def”; while (str != (str = str.replace(/<[^<>]*>/g, “”))); // str -> "abcdef" Notice that the regex in this one-liner doesn’t try to deal with nested patterns at all. The while loop’s condition replaces instances […]

More: continued here

No Comments Make A Comment

No comments yet.

Comments RSS Feed   TrackBack URL

Leave a comment

You must be logged in to post a comment.