小编J. *_*Doe的帖子

使用正则表达式的深(无限)NESTED分裂单词

重要编辑:由于许多人说应该避免这种情况并且几乎无法使用RegEx,我将允许您提供其他一些解决方案.从现在开始,任何解决方案都可以用作答案,最后是解决方案.谢谢!

让我们说:

$line = "{ It is { raining { and streets are wet } | snowing { and streets are { slippy | white }}}. Tomorrow will be nice { weather | walk }. }" 
Run Code Online (Sandbox Code Playgroud)

期望的输出:

It is raining and streets are wet. Tomorrow will be nice weather.
It is raining and streets are wet. Tomorrow will be nice walk.
It is snowing and streets are slippy. Tomorrow will be nice weather.
It is snowing and streets are …
Run Code Online (Sandbox Code Playgroud)

php regex arrays split explode

6
推荐指数
1
解决办法
153
查看次数

标签 统计

arrays ×1

explode ×1

php ×1

regex ×1

split ×1