\'HELLO world \"hello\"\' how to writ开发者_如何学运维e this regex which only substitute \'hello\' which is not in quote?Assuming you\'re using J" />
开发者

write a regular expression to substitute string like c macro?

'hello world "hello"'.replace(regex,"HELLO") => 'HELLO world "hello"'

how to writ开发者_如何学运维e this regex which only substitute 'hello' which is not in quote?


Assuming you're using Javascript:

'hello world "hello"'.replace(/($|[^"])hello(?!")/g,'$1HELLO');
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜