简体   繁体   English

PHP正则表达式无限模式

[英]php regex unlimited pattern

I'm looking to extend the regex below so I can have unlimited number of braces. 我希望在下面扩展regex ,以便可以使用无数个花括号。

((?:{[0-9]:[a-z]+})?)

So my string can handle {1:foo}{2:bar}{3:more} 这样我的字符串就可以处理{1:foo}{2:bar}{3:more}

Any ideas will be appreciate it! 任何想法将不胜感激!

Which function are you using in PHP for matching the expression? 您在PHP中使用哪个函数来匹配表达式? Using preg_match_all should work for you with the follow regex: /\\{([0-9]):([az]+)\\}/ 使用preg_match_all应该适用于以下正则表达式: /\\{([0-9]):([az]+)\\}/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM