Re: Learning regexes
by gmax (Abbot) on Apr 02, 2003 at 21:26 UTC
|
_ _ _ _
(_|| | |(_|><
_|
| [reply] [Watch: Dir/Any] |
Re: Learning regexes
by perlguy (Deacon) on Apr 02, 2003 at 21:29 UTC
|
| [reply] [Watch: Dir/Any] |
|
Yeah, I've read it.
In the last chapters there's a kind of statistical/mathematical approach in order to explain the possibilities of various matchings. Very hard&cool!
IMHO: perldoc perlre && perldoc perlretut
| [reply] [Watch: Dir/Any] |
•Re: Learning regexes
by merlyn (Sage) on Apr 02, 2003 at 21:26 UTC
|
| [reply] [Watch: Dir/Any] |
Re: Learning regexes
by phydeauxarff (Priest) on Apr 02, 2003 at 21:10 UTC
|
| [reply] [Watch: Dir/Any] |
Re: Learning regexes
by bart (Canon) on Apr 03, 2003 at 02:04 UTC
|
There's a chapter in Joseph N. Hall's book Effective Perl Programming dedicated to what you're summing up, here. That chapter, chapter 4, is freely available online as a PDF. | [reply] [Watch: Dir/Any] |
Re: Learning regexes
by hiseldl (Priest) on Apr 03, 2003 at 02:28 UTC
|
regexEvaluater may be of interest if you would like to take a more interactive approach.
It has menu options to insert special characters, character classes, posix character classes, quantifiers and groups. There are menu options to add regex options e.g. add 'giosm' to the end of a function. You can load a text file and run the regex on it, and it will hilight the matches, there is also an option to save the transformed text. There's also an option to save the regex as a script.
You will need Perl 5.6 and Perl/Tk. It's a nice tool, check it out.
-- hiseldl What time is it? It's Camel Time!
| [reply] [Watch: Dir/Any] |
Re: Learning regexes
by crenz (Priest) on Apr 03, 2003 at 14:30 UTC
|
Thanks for the good comments. My colleague was positively surprised with the number and quality of comments!
I think I will use the following approach:
- Read the articles mentioned (the PDF from Effective Perl Programming sure looks good!)
- Teach him the basics (., +, *, (/), character classes and the like) and what to use regexes for
- Use the regex evaluator together to gain proficiency
- Talk about basic pitfalls
Then, after a while we'll talk again about the traps he fell into :). By that time, I will also be able to see whether the more advanced concepts (look-ahead etc.) are really necessary for the work he needs to do.
| [reply] [Watch: Dir/Any] |
Re: Learning regexes
by SysApe9000 (Acolyte) on Apr 03, 2003 at 18:49 UTC
|
As mentioned earlier, Mastering Regular Expressions is good if you want to improve your regex kung-fu. However, I would like to note that split uses regexes. The first option to split() is a regex...
| [reply] [Watch: Dir/Any] |