Precisely. Let's ignore the syntax and mechanics, and re-examine the question (just in case it's helpful):
A regex is a way to find something in something else. When building one, you have to consider carefully what it is you're trying to find, as well as where you're trying to find it.
The root of this confusion was, "Why would I want to find none of something?"
If you've got an irregular something to find, based around regular features, you would want to find none of the irregular (but expected) things, all of the regular features, and would want to be able to fail on unexpected irregularities.
Similarly, if you've got something you want to find "no matter what", you could try to find it with no whitespace or punctuation (so that "important" would be the same as "*important*" and "I!M!P!O!R!T!A!N!T" and suchlike).
These are probably bad examples, as I do not write complicated regexes myself, but I think the context is correct.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.