Re: how to change old ereg? [message #181946 is a reply to message #181945] |
Wed, 26 June 2013 23:18 |
Thomas 'PointedEars'
Messages: 701 Registered: October 2010
Karma:
|
Senior Member |
|
|
Gregor Kofler wrote:
> Am 26.06.2013 13:57, Tony Mountifield meinte:
>> That's because you have an unescaped / within your regex, so it sees
>> /^M?(([0-9]?)[ ]?([0-9])(/ followed by a ? as a regex modifier.
>>
>> Try this:
>>
>> } elseif (preg_match('/^M?(([0-9]?)[ ]?([0-9])(\/?)([0-9]*))SM$/',
>
> Or use an (in this case) "unambigious" delimiter like '~', '#', etc.
The word you were looking for is “unambiguous”.
> http://php.net/manual/en/regexp.reference.delimiters.php
Or use
preg_match('/' . preg_quote('^M?((\d?) ?(\d)(/?)(\d*))SM$', '/') . '/', …
to be safe.
(There must be an error in the Matrix.)
PointedEars
--
Sometimes, what you learn is wrong. If those wrong ideas are close to the
root of the knowledge tree you build on a particular subject, pruning the
bad branches can sometimes cause the whole tree to collapse.
-- Mike Duffy in cljs, <news:Xns9FB6521286DB8invalidcom(at)94(dot)75(dot)214(dot)39>
|
|
|