Your question involves a bit of gray area. Firstly, regexes as used with most tools are line oriented, and as such do not contain embedded newlines, as these are record separators. Secondly, newlines in most contexts are considered to
be whitespace.
In Perl and Awk, record separators can be modified from their defaults, so a record may contain an embedded newline. After all that, Perl makes a special case out of records that contain newlines; see
http://www.regular-expressions.info/dot.html for the gory details.
Having said all of that, it often doesn't make sense to try to match too much or cover too many circumstances in a single regex. This may be just such a case, where you might be better off using a couple of regexes matches, and couple them with logical operators:
Code:
# perl example:
if( $stringData =~ m/^\s+/ || $stringData =~ m/\n/s ){
print "Yup, it matches\n";
}
Bottom line, is 'it depends' on the specific environment.
--- rod.