regex whitespace code example
Example 1: whitespace regex
\s is the regex character for whitespace. It matches spaces, new lines, carriage returns, and tabs.
Example 2: regex optional whitespace characters
// Add a \s? if a space can be allowed.
// \s stands for white space
// ? says the preceding character may occur once or not occur.
// If more than one spaces are allowed and is optional, use \s*.
// * says preceding character can occur zero or more times.
'#<a href\s?="(.*?)" title\s?="(.*?)"><img alt\s?="(.*?)" src\s?="(.*?)"[\s*]width\s?="150"[\s*]height\s?="(.*?)"></a>#'
Example 3: regex tab
Regex of tab representation:
[ \t]