开发者

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)/
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜