/(\[.*?\])/g
现在我想改变这种状况正则表达式匹配除电流匹配一切。我怎样才能做到这一点?
例如:
当前正则表达式:
here is some text [anything123][/21something] and here is too [sometext][/afewtext] and here
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
我想这一点:
here is some text [anything123][/21something] and here is too [sometext][/afewtext] and here
// ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^ ^^^^^^^^^
只需使用'replace'更换匹配。 'str.replace(/(\[.*?\])/ g,'')' – Tushar
@Tushar我想知道是否有任何方法来匹配除正则表达式中的模式之外的所有内容? – stack
我会按照Tushar的建议使用替换,这就是我要说的。 – Veverke