PHP regular expression reverse reference solution? Php reverse capture does not know what is going on. Remove the four consecutive numbers in the following string. Fsdfsdafasfasdfsdf <{2365}>? & Lt ;? Phpheader ("Content-t PHP regular expression reverse reference solution?
Use phpReverse capture does not know what is going on.
Remove the four consecutive numbers in the following string.
Fsdfsdafasfasdfsdf <{2365}>
In addition, please analyze what problems I have written?
Header ("Content-type: text/html; charset = utf-8 ");
$ Str = "fsdfsdafasfasdfsdf <{2365}> ";
$ Mypreg = "/<{(\ d)}>/"; // () indicates four consecutive numbers, use parentheses to capture this subexpression and reference it later.
$ Mycon = "\ 1"; // This is the replacement content. I reverse reference the four numbers above 2365, use these four numbers to replace the entire block with an external symbol <{2365}>
Echo $ str;
Echo"
";
$ Str = preg_replace ($ mypreg, $ mycon, $ str );
Echo $ str;
The result is that <{2365}> is captured, but there is no content in the reverse reference. it should be that the reverse reference is wrong and the content is not referenced. Please advise. Share To:, please also analyze where I wrote the problem?
------ Solution --------------------
Isn't it the group name of the subexpression?
To specify the group name of a subexpression, use the following syntax :(? \ W +)
Word is the group name of the expression.
Syntax referenced later \ k
I am not familiar with new learning either.
------ Solution --------------------
$ Mycon = "\ 1 ";
Or
$ Mycon = '\ 1 ';
Yes