Regular expression string with minor issues
$ Str = '[ol5FeByKjdWCdTRjZAuF] 1 @ 2012-06-19 20:46:44 ';
I want to get
Content in []
] And @
@ Content
How to write regular expressions ......
All the lessons learned in the school are returned to the teacher.
Reply to discussion (solution)
print_r(preg_split('/[\[\]@]/', $str, -1, PREG_SPLIT_NO_EMPTY));
print_r(preg_split('/[\[\]@]/', $str, -1, PREG_SPLIT_NO_EMPTY));
I now write preg_match ("/\[(.*?) \] (. *?) @ (\ D {4}-\ d {2}-\ d {2} \ s \ d {2 }:\ d {2 }:\ d {2 }) /", $ str, $ m );,
The matching result is
$ M = Array ([0] => [ol5FeByKjdWCdTRjZAuF] 1 @ 2012-06-19 20:46:44 [1] => ol5FeByKjdWCdTRjZAuF [2] => 1 [3] => 20:46:44)
How to modify the regular expression can remove the first entry ($ m [0]) in the current result
You cannot modify the regular expression. you can use the array_shift () function to delete the first element.
You cannot modify the regular expression. you can use the array_shift () function to delete the first element.
Forget it. this is a small problem.