Click here to get back home

Perl regular expression engine

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Perl regular expression engine Ricardo 06-30-2008
Get Chitika Premium
Posted by Ricardo on June 30, 2008, 10:09 pm
Please log in for more thread options
Hi all,

I was wondering if someone could point me some ref on what algorithms
are used by perl to find matches between regular expressions and
text? Is it a dfa?
Thanks!

Posted by Ben Morrow on June 30, 2008, 11:13 pm
Please log in for more thread options

>
> I was wondering if someone could point me some ref on what algorithms
> are used by perl to find matches between regular expressions and
> text? Is it a dfa?

No, it's a form of NFA, to allow capturing. The only real reference for
the algorithms used by perl is reg.c in the perl source, but
I *really* wouldn't recommend starting there :). Find a good reference
on POSIX regular expression implementations.

Ben

--
It will be seen that the Erwhonians are a meek and long-suffering people,
easily led by the nose, and quick to offer up common sense at the shrine of
logic, when a philosopher convinces them that their institutions are not based
on the strictest morality. [Samuel Butler, paraphrased] ben@morrow.me.uk

Posted by Uri Guttman on July 1, 2008, 12:09 am
Please log in for more thread options

>>
>> I was wondering if someone could point me some ref on what algorithms
>> are used by perl to find matches between regular expressions and
>> text? Is it a dfa?

BM> No, it's a form of NFA, to allow capturing. The only real reference for
BM> the algorithms used by perl is reg.c in the perl source, but
BM> I *really* wouldn't recommend starting there :). Find a good reference
BM> on POSIX regular expression implementations.

and get the book mastering regular expressions. it doesn't show detailed
algorithms but explains them well enough to learn about them. and it
covers almost all major regex versions in many different programs.

uri

--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------

Posted by Tad J McClellan on July 1, 2008, 7:45 am
Please log in for more thread options
>
> >>
> >> I was wondering if someone could point me some ref on what algorithms
> >> are used by perl to find matches between regular expressions and
> >> text? Is it a dfa?
>
> BM> No, it's a form of NFA, to allow capturing. The only real reference for
> BM> the algorithms used by perl is reg.c in the perl source, but
> BM> I *really* wouldn't recommend starting there :). Find a good reference
> BM> on POSIX regular expression implementations.
>
> and get the book mastering regular expressions. it doesn't show detailed
> algorithms but explains them well enough to learn about them. and it
> covers almost all major regex versions in many different programs.


See also:

How Regexes Work:

http://perl.plover.com/Regex/article.html

--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher0cmdat/"

Posted by Hans Mulder on July 1, 2008, 5:13 pm
Please log in for more thread options
Ben Morrow wrote:
>> I was wondering if someone could point me some ref on what algorithms
>> are used by perl to find matches between regular expressions and
>> text? Is it a dfa?
>
> No, it's a form of NFA, to allow capturing. The only real reference for
> the algorithms used by perl is reg.c in the perl source, but
> I *really* wouldn't recommend starting there :). Find a good reference
> on POSIX regular expression implementations.

If you really want to know how it's implemented, there's
http://search.cpan.org/~rgarcia/perl-5.10.0/pod/perlreguts.pod

This is easier to understand then the C code. It still assumes you
already know what regular expressions do and want to know more about
how it's done.

Hope this helps,

-- HansM





Similar ThreadsPosted
Questions on scalar references in general, substr and regular expression engine in particular May 15, 2008, 3:40 pm
Perl, Regular expression? December 23, 2005, 10:36 pm
perl regular expression help August 7, 2006, 2:47 am
perl regular expression April 13, 2007, 2:11 am
Regular Expression: Perl and vi August 13, 2007, 1:58 pm
Serious Perl Regular Expression deficiency? December 23, 2005, 3:17 pm
How to handle nested regular expression in perl November 14, 2005, 7:33 pm
Question about "?" character in Perl Regular Expression January 2, 2008, 2:58 am
Perl newbie regular expression usage question/help November 11, 2007, 10:18 am
$5 reward for this Perl script (regular expression searches through an entire directory of files) November 9, 2007, 8:14 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap