Skip to Main Content
Wicked Cool Perl Scripts
book

Wicked Cool Perl Scripts

by Steve Oualline
February 2006
Intermediate to advanced content levelIntermediate to advanced
304 pages
6h 16m
English
No Starch Press
Content preview from Wicked Cool Perl Scripts

#44 Regular Expression Parser

In order to be able to graph a regular expression, you first must figure out what's in it. That's the job of the parse.pm module.

The Code

 1 # 2 # parse_re -- Parse a regular expression 3 # 4 use strict; 5 use warnings; 6 7 package parse; 8 require Exporter; 9 10 use English; 11 12 use vars qw/@ISA @EXPORT/; 13 14 @ISA = qw/Exporter/; 15 @EXPORT = qw/parse_re/; 16 17 ################################################ 18 # parse_re -- Parse a regular expression 19 # and return an array of parsed data 20 ################################################ 21 sub parse_re($) 22 { 23 # The regular expression to use 24 my $quote_re = shift; 25 26 $quote_re =~ s/\\/\\\\/g; 27 28 # The command to get the debug output 29 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Perl Debugged

Perl Debugged

Peter Scott, Ed Wright
Perl & LWP

Perl & LWP

Sean M. Burke
Pro Perl

Pro Perl

Peter Wainwright

Publisher Resources

ISBN: 1593270623Catalog PageErrata