node.js - How to include space and new line in regular expression? -
i have html file contains below code snippet.
<div class="col-sm-2 col-sm-offset-1"> <div class="countbox success" id="success"> <h2>467</h2> passed tests <span class="glyphicon glyphicon-eye-open"></span> </div> </div>
i have regular expression (.*)</h2>\r\npassed value 467. worked till yesterday. but, not working now. have tried replacing single slash double slash new line , row. used "\s+" cover whitespace. failed in error. please guide me on how value 467 using regular expression above code snippet?
it better catch <h2>(\d+)</h2>
ensure h2
header number inside. way, \r\n
1 convention (in windows) represent end of line, in unix \n
more platform independent, can \r?\n
(marking \r
optional) , have on whitespace in front of passed.
, (but not best) regexp be:
<h2>(\d+)<\/h2>\r?\n\s*passed
see demo.
Comments
Post a Comment