Why does this regex fail on the last text input containing punctuation characters?
As demonstrated here:
http://jsfiddle.net/beardedgrandma/x8fy9/
this regex:
/([\w .]*)[~]([\w .]*)(\(|Release Date)/
fails on this text input:
<div>Watergate F开发者_运维知识库iles: Bernstein & Woodward ~ Alastair Campbell (Author) (19)Release Date: Decemb</div>
Presumably this is because of the punctuation in the title:
Watergate Files: Bernstein & Woodward
How to correct this?
Try:
/([^~]+)~([^~(]+?)(?:\(|Release Date)/
精彩评论