特殊字符之间的字符串

特殊字符之间的字符串

当它也可以在没有最后两个括号的情况下出现时,我如何在这些特殊字符之间提取以下字符串?

[Sometext Noworry (Sometext)] I need this string (This string is ok too) [Dontwantit] [Dontwantiteither]

或者

[Sometext Noworry (Sometext)](whitespace here sometimes)I need this string (This string is ok too)

或者

(Notneeded) [Sometext Noworry (Sometext)] I need this string (This string is ok too)

或者

[Sometext Noworry (Sometext)](whitespace here sometimes)I need this string (This string is ok too) {Notwanted}

努力进行积极的后视观察,但到目前为止我已经得到:

/[^\[\]]+(?=\[|$)/g

相关内容