Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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).

In reply to Re:This looks like someone sneezed and hit the keyboard by Anonymous Monk
in thread This looks like someone sneezed and hit the keyboard by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-06-25 08:45 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.