in reply to newline in unix
"\s" will match a newline (and carriage-return if you have any); when "." is inside square brackets (as part of a character class), it does not work as a wildcard, and will only match a literal period.
You could simplify your regex a lot (and make it easier to understand and less likely to break):
(update: removed spurious open paren from start of regex)if ( /CONNAME.([\d.]+).*?CURRENT\s+CHL/ ) { print $&, $/; }
The [\d.]+ bit will match a string consisting of digits and/or periods (one or more) -- i.e. any of ".", "..", "...", "1", "12", "123", "1.2.3", etc. Meanwhile, the periods outside the square brackets will match anything, like parens, whitespace, etc.
|
|---|