in reply to Re^3: Regex: Ignore \n in \S
in thread Regex: Ignore \n in \S

Holy cow. Thank you. I've spent over 3 hours trying to tackel it! Thank you!

Replies are listed 'Best First'.
Re^5: Regex: Ignore \n in \S
by Marshall (Canon) on Sep 12, 2010 at 21:25 UTC
    Corion's analysis is right. As a question, you may not even need to fiddle with the \n at all, by changing from \S to \w. a word char is 0-9A-Za-z_ and therefore \ won't match. Its not clear to me what all kind of characters could be in "theoneiwant" anyway if your data allows it something even simpler can be done...
    for (<DATA>) { print "Matched: $1\n" if m/DIP\s+\S+\s+(\w+)/; #([\w-]+) to allow - };