Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: [Try-out] Regexp do's and don'ts

by gumpu (Friar)
on Aug 15, 2004 at 09:37 UTC ( #383070=note: print w/ replies, xml ) Need Help??


in reply to Regexp do's and don'ts

Hoi,

Good stuff! Has the potential be very useful for newbies. One point:

"5. Don't use regexes for formats without a definite syntaxis, like human language. Regexes are good for pattern matching (and substitution), not for langague analyzing."

Think you have to be a bit more specific here. Computer languages have a definte syntax but using regular expressions to parse them can be a very painful process. (I Know this from experience cause I once tried to make a code beautifier for C++ and Pascal). In those cases a proper parser (say Parse::RecDescent) is much better.

If you are just trying to find simple things in source code, for instance #include statements or simply formatted comment blocks, regular expressions would be fine.

Have Fun


Comment on Re: [Try-out] Regexp do's and don'ts
Re^2: [Try-out] Regexp do's and don'ts
by Anonymous Monk on Sep 26, 2004 at 15:29 UTC
    as long as you don't define better as faster, yes, it is much better :D

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://383070]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2014-11-01 09:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (229 votes), past polls