Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Every REGEXP switch and option

by Kozz (Friar)
on Mar 27, 2000 at 00:16 UTC ( #6187=perlquestion: print w/replies, xml ) Need Help??

Kozz has asked for the wisdom of the Perl Monks concerning the following question:

Is there a good plce to find information on all the available special characters, switches, options that can be used in a REGEXP string matching & searches? I feel comfortable with REGEXPs to a point, but I want to learn more about how they are used in matching, with things like m//g or s// or tr//isgcemx and all those letters that come BEFORE and AFTER the first and last slashes... Do I need to buy a book? Or is there a good webpage/site on this?

Replies are listed 'Best First'.
RE: Every REGEXP switch and option
by chromatic (Archbishop) on Mar 27, 2000 at 00:32 UTC
    The first place to start is perldoc perlre. If you're in a Unixy environment, just type that at a command prompt (I think it works that way in Windows too, but I rarely program there). With the Activestate compiler, HTML documentation is installed in your Start menu.

    From there, two excellent books are Programming Perl (from O'Reilly) and Mastering Regular Expressions (also from O'Reilly). Both are a little bit dated, but they'll have 98% of the information you're likely to need. Also check out places like for more up-to-the-minute information.

Re: Every REGEXP switch and option
by btrott (Parson) on Mar 27, 2000 at 00:31 UTC
    Have you looked at perlop and perlre? Those are, probably, the definitive sources on the regex switches and options. You might also take a look at Jeffrey Friedl's book, Mastering Regular Expressions. It's a bit outdated now, since there's been a lot of new regex functionality added since the book was published; but it's still a good source.

    By the way: the possible switches for the tr operator are

Re: Every REGEXP switch and option
by turnstep (Parson) on Mar 28, 2000 at 22:44 UTC

    Another good source is the Perl Cookbook, Chapter 6. While it obviously cannot cover as much in one chapter as the Mastering Regular Expressions book, the chapter is excellent with many "recipes" and a good style that goes beyond the information in Programming Perl. Plus, you'll find the book invaluable for other things as well. Highly recommended. Available, of course, from O'Reilly:

    Perl Cookbook

    Update: Better yet, buy it through the unholy alliance of Fatbrain and Perlmonks here: Perl Cookbook :)

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://6187]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2022-05-19 16:25 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (72 votes). Check out past polls.