regex - php preg_match_all separated by an optional pattern -


i've string follows pattern "[:it]stringa in italiano[:en]string in english". i'm trying use preg_match_all capture locales , associated strings, ie:

[1] => 'it', [2] => 'en', ... [1] => 'stringa in italiano', [2] => 'string in english' 

the regex i'm using "/\[:(\w+)](.+?)(?=\[:\w+])/g" (https://regex101.com/r/ez1gt7/400) returns first group of data. i'm doing wrong? thanks.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -