开发者

Javascript -- regex strings

Simple question... I am just baffled how to write the notation.

Example: input='..."aaaa\"bbbb"...'

I need regex to grab the string ignoring nested开发者_开发技巧 quotations.

I guess it can start like: input=input.replace(/[^\\]"...

How can I say 'all characters until a " which is not preceded by a \' ?

Thanks!


"([^"\\]|\\.)*"

Inside the quotes can be (a) any character aside from a quote or backslash, or (b) any character if it's escaped with a backslash. Repeat.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜