You should be able to use just /hello\s+world/ as your regular expression.if( $test_string =~ /hello(\s+)world/ig ) { $spaces_between = $1; ### $1 comes from matching the ### expression in parenthesis $ct_spaces_between = length $spaces_between; print "FOUND IT! The number of spaces between 'hello' and 'world +' was $ct_spaces_between\n"; }
HTH.
In reply to Re^2: disregard spaces while matching ?
by hmerrill
in thread disregard spaces while matching ?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |