相关疑难解决方法(0)

正则表达式,用于在方括号或大括号之间提取文本

与我之前的问题相关,我有一个以下格式的字符串:

this {is} a [sample] string with [some] {special} words. [another one]
Run Code Online (Sandbox Code Playgroud)

在正方形大括号内提取单词的正则表达式是什么,即.

{is}
[sample]
[some]
{special}
[another one]
Run Code Online (Sandbox Code Playgroud)

注意:在我的用例中,括号不能嵌套.我还想保留封闭的字符,这样我就可以在处理结果时区分它们.

regex

5
推荐指数
1
解决办法
4155
查看次数

标签 统计

regex ×1