如何反转此正则表达式/“[^”] *" / g [英] How to inverse this regex /"[^"]*"/g

查看:125
本文介绍了如何反转此正则表达式/“[^”] *" / g的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找到除了/[^] */ g



i试过很多网站但是没有得到任何答案的所有内容



i试过这个



str ='xyabbccddeghjk';



/(?![^] *)[^] * / g



/ * i想要这个结果>> xy,bc,de,jk * /



我尝试了什么:



str ='xyabbccddeghjk';



/(?![ ^] *)[^] * / g



/ *我想要这个结果>> xy,bc,de,jk * /

i want to find everything except /"[^"]*"/g

i tried many sites but didnt get any answer yet

i tried this

str = 'xy"ab"bc"cd"de"gh"jk' ;

/(?!"[^"]*")[^"]*/g

/* i want this result >> xy,bc,de,jk */

What I have tried:

str = 'xy"ab"bc"cd"de"gh"jk' ;

/(?!"[^"]*")[^"]*/g

/* i want this result >> xy,bc,de,jk */

推荐答案

我不会尝试反转 /[^] */ g

我会用这个RegEx替换为逗号,然后用逗号分隔。
I would not try to inverse /"[^"]*"/g.
I would do a replace with this RegEx to comma, and then split on comma.


这篇关于如何反转此正则表达式/“[^”] *" / g的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆