These bits of verse are a result of my having been obsessing over good examples of when the /s and /m modifiers should be used in regexes: see this node .

Poem number one:


slash-s means that dot
includes newlines as well
slash-m affects markers,
it allows you to tell
your regex that caret,
(and dollar, its friend)
match at line start and end,
not just string start and end.


Poem number two (limerick):


slash-s tells your regex that dot
includes newlines too (normally not)
slash m says that dollar
and caret can holler
"a match" when line edges are caught


Poem number three (kind of Dr Seuss mode):


m affects markers, the start-and-end signs
which anchor your regex to places in lines
they're caret and dollar, in case you don't know
they match special places, as listed below:
without m, respectively, "start/end of a string"
but with it, each line-start-and-end match these things

s affects one thing, the dangerous dot,
which matches all characters, no matter what,
there's only one thing that it won't match: newline,
to over-ride this you employ the s-sign
add slash-s to your regex and the period portion
matches newlines as well, so proceed with great caution...

--
“Every bit of code is either naturally related to the problem at hand, or else it's an accidental side effect of the fact that you happened to solve the problem using a digital computer.”
M-J D

In reply to Poetry about perl by Cody Pendant

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



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.