Help with Regex on Parameter delimiter
I have to match the following text:
var html = '<td align="right" width="26%">
<span class="text2-mbna" style="position:relative; left:10px;">
$0.开发者_运维问答00</span>
</td>'
I have this regex
/<span class="text2-mbna" style="position:relative; left:10px;">(?:\s+)((?:\$)((\d|,)+)\.(\d+))<\/span>/.exec(html)
I can actually just replace it in javascript, but I want to know how to NOT capture the dollar($) sign.
Just move (?:\$)
before the open paren to its left, giving:
/<span class="text2-mbna" style="position:relative; left:10px;">(?:\s+)(?:\$)(((\d|,)+)\.(\d+))<\/span>/
You don't need (?:)
there anyway; it can just be
/<span class="text2-mbna" style="position:relative; left:10px;">\s+\$(((\d|,)+)\.(\d+))<\/span>/
精彩评论