replace a frame  [ 871 views ]

Goal: remove marker from a text

The problem is simple. I have a markered text like this:

this is <span class="mark">mark</span>ered

and I want to remove the marker structure quickly. The solution with regex back-reference:

  x = x.replace(/(<span class="mark">([^<]+)<\/span>)/ig, '$2');

where
x the markered text itself
$1 (not used) is the main regex: (<span class=”mark”>…<\/span>)
$2 (what we need to keep) is the second regex: ([^<]+)

#sidebar a { color:#fff; } #sidebar ul ul li { color: #DEF585; } #sidebar h2 { color: #fff; } #sidebar ul p, #sidebar ul select { color: #BEDDBE; } #backfly { background: url(images/golfBallWallPaper.jpg) left bottom fixed repeat-x #65a51d; }