Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What class of language can Perl regular expressions be used against?

I know that some of the capabilities of the Perl regular expression engine are not regular. However, what class is it? It might be context-free, but CS theory was never my strongest subject.

like image 415
Thomas Owens Avatar asked Sep 30 '09 14:09

Thomas Owens


People also ask

What regex does Perl use?

Perl's regexes are more like the Posix extended ones. Basic posix regular expressions use ( and { to match the actual characters, and \( and \{ as special characters, but the Posix extended ones use ( and { for the same meaning as in Perl and \( or \{ to match the actual characters, the same as Perl.

Does Python use Perl regex?

Python supports essentially the same regular expression syntax as Perl, as far as the regular expressions themselves. However, the syntax for using regular expressions is substantially different.

Is Perl good for regex?

In general, Perl uses a backtrack regex engine. Such an engine is flexible, easy to implement and very fast on a subset of regex. However, for other types of regex, for example when there is the | operator, it may become very slow.

Does PHP use Perl regex?

PHP uses a C library called pcre to provide almost complete support for Perl's arsenal of regular expression features. Perl regular expressions include the POSIX classes and anchors described earlier.


1 Answers

Actually, many implementations are neither regular nor context-free; patterns have become their own beast. This Wikipedia article has more on this, including a bit from Larry Wall, the author of the Perl language.

like image 90
geowa4 Avatar answered Sep 29 '22 09:09

geowa4