I resisted asking a simple regex question. I understand newlines, but my problem comes with matching text after my newline. I can successfully match the newline.

My text is:
CONNAME(163.231.99.129) CURRENT CHLTYPE(SVRCONN) STATUS(RUNNING) LSTMSGTI(03.45.47) LSTMSGDA(2003-11-21)

My regex is:
if (/CONNAME\((.*\..*\..*\..*)\)[\s.]*CURRENT[\s.]*CHL/is){ print "$&\n"; }


I can match the newline with: (/CONNAME\((.*\..*\..*\..*)\)[\s.]*CURRENT[\s.]*

But, when I add even one letter, it fails. There is white space before CHLTYPE, but I accounted for that.

If I take off the [\s.]* at the end, I don't match the newline, which confirms that I'm matching it with it on (it also prints out a newline, which also confirms the match. It's that dang character after the newline.

Please help. I've looked through the forum and most deals with matching the newline. I got that far, and I know unix is \n, which \s should, and does, match.

Thanks,
BrassMonkey
"that funky Monkey"

Edited by Chady -- added code tags.


In reply to newline in unix 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":



  • 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.