我想处理文本文件中的一些字符串。我尝试了很多正则表达式模式,但没有一个适合我
someone can tell/figure
a/the squeaky wheel gets the grease/oil
accounts for (someone or something)
that's/there's (something/someone) for you
我需要以下字符串组合:
someone can tell
someone can figure
a squeaky wheel gets the grease
a squeaky wheel gets the oil
the squeaky wheel gets the grease
the squeaky wheel gets the oil
accounts for someone
accounts for something
that's something for you
that's someone for you
there's something for you
there's someone for you
编辑:更正括号和“或”,我错过了上一个版本
一个简单的循环解决方案,也适用于多个斜杠(他/她/它/任何东西):
结果:
这有点棘手,但主要思想是在到达
\
时复制到目前为止的选项,并跟踪其中的两个选项,请看以下内容:输出:
您可以使用笛卡尔积:
输出:
相关问题 更多 >
编程相关推荐