开发者

Javascript -- regex strings

开发者 https://www.devze.com 2023-01-27 11:56 出处:网络
Simple question... I am just baffled how to write the notation. Example: input=\'...\"aaaa\\\"bbbb\"...\'

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

精彩评论

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

关注公众号