Forum Moderators: coopster
Note: As of PHP 5.3.0 this extension is deprecated, calling any function provided by this extension will issue anE_DEPRECATEDnotice.
I read this today on the POSIX Regex Functions [php.net] manual page. I never did use them, personally. For regular expressions I have always been partial to the Perl-compatible syntax so I use the PCRE functions [php.net].
The 5.3 release wiki [wiki.php.net] also states "No longer allow to disable" PCRE. Looks like the development team has standardized on a single regular expression engine for the future.
Your thoughts?
My feeling is that there might be a slightly higher learning curve for PCRE, but that the process is certainly worth it. And that syntax is much more interoperable than POSIX these days.
Also note that on that page it refers to
Perl 5.005where as the current version shipping in PHP 5.2.8 is version 7.8!
I too think it is good move, one less thing to try and remember I started out with ereg and the POSIX regex stuff for no other reason then I didn't know any better.
I really think a lot of the php tutorials available on the net had been written a long long time ago and instead of updating the code to current best practices the site ops just left it up since it got good traffic or pure laziness.
I am still in the process of learning best practices but it takes a lot of work to find the good or right solution so I think that having one less choice when you don't know what to choose or why is a good thing.
Perl is v5.10.0 and the PCRE library is v7.8
Yes, thanks for catching that, bkeep. I read the documentation as referring to the PCRE library version where as it is seemingly referring to the version of perl itself. And we certainly don't need to be any more confused!
Which in turn reminded me of something to note for janharders and others reading this thread. If you find yourself pondering "how can I know which modifiers and switches are available to me in the pcre functions?", the answer is found in your php version configuration. Check the pcre library installed for your current PHP version (run a phpinfo() script and search the page for "pcre") and then check the pcre man page [pcre.org]. A short little sentence in the first paragraph ties it together for you ...
The current implementation of PCRE (release 7.x) corresponds approximately with Perl 5.10
Knowing that, I assumed correctly that I could use some of the *new* pcre modifiers that I was reading in the
perlreperldoc pages that I needed in some of my work. This was how I first figured out that they were available to me.