I can not understand why this is happening

исходная строка: $data = "structure.declination(123, результат, результата, результатов)" regexp: preg_match_all("/([AZ]*[az]*[0-9]*[_]*)+[.]([AZ]*[az]*[0-9]*[_]*)+[(]([AZ]*[А-я]*[az]*[0-9]*[%@':\-.|<,>*#\/_ ]*)+([%]..+[%])*[)]/", $data, $mass); 

php fails validation i. $ mass is empty, and I'm testing it at gskinner.com/ReExExr/ everything works

Moreover, if you replace Russian letters with English ones and remove the condition that I added [AZ], then everything works fine, but the point is to work together with Russian letters

  • such question: what do you want to receive? maybe we'll give you a simpler regular schedule. And you experience and we feel good. On the topic: I can not start the regular season, I tried everything, the results are 0. - lampa
  • there are macros like% structure.name (param1, param2, parm3)% - macro function and type% count% - macro value current regular works on English letters ie In param, you can transfer almost everything (except for Russian letters), I need to transfer the Russian letters to the parameters as in the example, the system determines whether it is a macro according to the regular schedule, further there is an analysis of parameters, etc., etc., but support for Russian letters I can’t finish it, although logically it seems to be correct - unlike777

2 answers 2

 $data = "structure.declination(123, русский, чочочо, mamamia)"; preg_match_all("/(\w*)\.(\w*)\((.*?)\)/", $data, $mass); var_dump($mass); array(4) { [0]=> array(1) { [0]=> string(52) "structure.declination(123, русский, чочочо, mamamia)" } [1]=> array(1) { [0]=> string(9) "structure" } [2]=> array(1) { [0]=> string(11) "declination" } [3]=> array(1) { [0]=> string(29) "123, русский, чочочо, mamamia" } } 

If I understood correctly.

  • Thanks, but not quite)) the macro is needed as a whole without parts, the analysis of the macro itself goes further. But in general, the answer was already found here, the casket just opened as always, at the end of the regular season it was necessary to put / u PS how do all these encodings infuriate me> _ < - unlike777
  • one
    Well, yes, either the “u” modifier could be substituted :-) You can also simplify the construction ([AZ] * [az] * [0-9] * [ ] *) in ([a-z0-9- ] *) + add modifier "i" - lampa

Do not write separately characters that can be interspersed. Also use the i modifier to not list all possible character registers. I have this template for your situation:

 preg_match_all("/([a-z0-9_.]*)+\(([a-za-я0-9%@':\-.|<,>*#\/_ ]*)\)/i", $data, $mass);