【发布时间】:2011-01-25 02:39:26
【问题描述】:
与我的previous question 相关,我有一个格式如下的字符串:
this {is} a [sample] string with [some] {special} words. [another one]
提取方或大括号内的单词的正则表达式是什么,即。
{is}
[sample]
[some]
{special}
[another one]
注意:在我的用例中,括号不能嵌套。我还想保留封闭字符,以便在处理结果时可以区分它们。
【问题讨论】:
-
如果字符串是
blah [{] blah {]}怎么办?
标签: regex