Verbose regular expressions in PHP?

痴心易碎 提交于 2019-12-01 21:24:02

You can also set 'expanded' mode modifier within the regex as long as its the first char past the
delimiter.

= '/(?x)
                     # A comment
     (               # (1 start), some capture
        . 
     )               # (1 end)
  /';

And/Or, it should also be available within //x context

'/
                   # A comment
   (               # (1 start), some capture
        . 
   )               # (1 end)
/x';

Or, you can freely move in/out of x-mode within the code

'/((?x)            # (1 start), some capture
        .
       (?-x: A )   # ' A ' 
   )               # (1 end)
/'
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!