Regular Expressions. Introduction to Regexes in Perl 5. Regex character classes. Regex: special character classes. Perl 5 Regex Quantifiers. trim - removing leading and trailing white spaces with Perl.
It seems to me like using a REGEX in this case would just be overkill. Why not just just strpos to find the space character. Also, there's nothing special about the space character in regular expressions, you should be able to search for it the same as
up vote 3 down vote. In Perl the switch is \s (whitespace).
\s matches more than just the space character. It includes TAB, linefeed carriage return, and others (how many others depends on the regex flavor). It's a Perl invention, originally a shorthand for the POSIX character class [:space:], and not supported in sed.