in reply to Alternation metacharacter across multiple lines in regex not working

String like things in Perl allow new lines to be part of the string (unlike many other languages). That is true for double quoted (") and single quoted (') strings and for regular expressions (among others).

Your "wrapped" regular expression contains white space that is part of the expression to be matched! You can use the /x flag it ignore most white space in your regular expression. Try:

print "\nTRUE\n" if ( $output =~ /The.*?command\stakes.*?arguments;\syou\sgave.* |Illegal\soption.* |.*?is\snot\sa\svalid\soption.*/ix );

True laziness is hard work
  • Comment on Re: Alternation metacharacter across multiple lines in regex not working
  • Download Code