while (content =~ m%One(.*?)three(.?)five\s+six(.*?)this%gs) { ^^^^^^^