Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re:This looks like someone sneezed and hit the keyboard

by Anonymous Monk
on Feb 05, 2004 at 09:00 UTC ( [id://326724]=note: print w/replies, xml ) Need Help??


in reply to Re: This looks like someone sneezed and hit the keyboard
in thread This looks like someone sneezed and hit the keyboard

Hi, There is an article on perl.com that might be useful: http://www.perl.com/pub/a/2004/01/16/regexps.html
Regexes are a programs. It takes time to learn new languages and that's why it might look difficult at the begining. With time and practice that kind of regex become (almost) clear.
Using /x and commenting is very important but having the right support from the tools you use is also important. Here is a little html document that show your regex colored. I couldn't get it to show directly in this answer so you'll have to copy past :-(:
<HTML> <HEAD> <TITLE>Smed generated dump</TITLE> </head> <body bgcolor="#FFFFFF"> <FONT color=#000000 style="BACKGROUND-COLOR: #ffffff"> <br> </FONT> <FONT color=#000000 style="BACKGROUND-COLOR: #ffffff"> <br> </FONT> <FONT color=#f00000 style="BACKGROUND-COLOR: #ffffff"> / </FONT> <FONT color=#ffff00 style="BACKGROUND-COLOR: #ff0000"> .* </FONT> <FONT color=#ffffff style="BACKGROUND-COLOR: #ff0000"> ( </FONT> <FONT color=#ffff00 style="BACKGROUND-COLOR: #643296"> [\$#\%&gt;~] < +/FONT> <FONT color=#000000 style="BACKGROUND-COLOR: #00ff00"> | </FONT> <FONT color=#ff0000 style="BACKGROUND-COLOR: #ffff00"> \@ </FONT> <FONT color=#000000 style="BACKGROUND-COLOR: #afeeee"> \w </FONT> <FONT color=#000000 style="BACKGROUND-COLOR: #f0f0ff"> ~ </FONT> <FONT color=#ff0000 style="BACKGROUND-COLOR: #ffff00"> \$ </FONT> <FONT color=#000000 style="BACKGROUND-COLOR: #00ff00"> | </FONT> <FONT color=#ff0000 style="BACKGROUND-COLOR: #ffff00"> \\ </FONT> <FONT color=#ff0000 style="BACKGROUND-COLOR: #ffff00"> \[ </FONT> <FONT color=#ff0000 style="BACKGROUND-COLOR: #ffff00"> \\ </FONT> <FONT color=#000000 style="BACKGROUND-COLOR: #f0f0ff"> e </FONT> <FONT color=#ff0000 style="BACKGROUND-COLOR: #ffff00"> \[ </FONT> <FONT color=#000000 style="BACKGROUND-COLOR: #f0f0ff"> 0 </FONT> <FONT color=#000000 style="BACKGROUND-COLOR: #f0f0ff"> m </FONT> <FONT color=#ff0000 style="BACKGROUND-COLOR: #ffff00"> \\ </FONT> <FONT color=#ff0000 style="BACKGROUND-COLOR: #ffff00"> \] </FONT> <FONT color=#000000 style="BACKGROUND-COLOR: #f0f0ff"> </FONT> <FONT color=#ff0000 style="BACKGROUND-COLOR: #ffff00"> \[ </FONT> <FONT color=#000000 style="BACKGROUND-COLOR: #f0f0ff"> 0 </FONT> <FONT color=#000000 style="BACKGROUND-COLOR: #f0f0ff"> m </FONT> <FONT color=#ffffff style="BACKGROUND-COLOR: #ff0000"> ) </FONT> <FONT color=#000000 style="BACKGROUND-COLOR: #afeeee"> \s </FONT> <FONT color=#f00000 style="BACKGROUND-COLOR: #f0f0ff"> ? </FONT> <FONT color=#f00000 style="BACKGROUND-COLOR: #ffffff"> / </FONT> <FONT color=#000000 style="BACKGROUND-COLOR: #ffffff"> <br> </FONT> <FONT color=#000000 style="BACKGROUND-COLOR: #ffffff"> <br> </FONT> </body> </HTML>
If your text editor supported this, you would have less problems getting in regexes. There few tools to work on regexes and they do the coloring as well.

Cheers, Nadim (NKH).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-06-14 13:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.