if ( /foo # Match starting at foo (?: # Complex expression: (?!baz) # make sure we're not at the beginning of baz . # accept any character )* # any number of times bar # and ending at bar /x ) { # print stuff out. } else { print "Failed to match against '$_'\n"; }