我有一个正则表达式,最终会变得有点长,并且它可以使它更容易阅读并跨越多行。
preg_match('
^J[0-9]{7}:\s+
(.*?) #Extract the Transaction Start Date msg
\s+J[0-9]{7}:\s+Project\sname:\s+
(.*?) #Extract the Project Name
\s+J[0-9]{7}:\s+Job\sname:\s+
(.*?) #Extract the Job Name
\s+J[0-9]{7}:\s+
', $this->getResultVar('FullMessage'), $atmp);
有没有办法将以上形式的正则表达式传递给preg_match?
发布于 2018-05-03 15:33:29
preg_match("/
test
/x", $foo, $bar);
发布于 2018-05-03 16:56:26
preg_match('/
^J[0-9]{7}:\s+
(.*?) #Extract the Transaction Start Date msg
\s+J[0-9]{7}:\s+Project\sname:\s+
(.*?) #Extract the Project Name
\s+J[0-9]{7}:\s+Job\sname:\s+
(.*?) #Extract the Job Name
\s+J[0-9]{7}:\s+
/x', $this->getResultVar('FullMessage'), $atmp);
https://stackoverflow.com/questions/-100001555
复制相似问题