s/(?<=a)b/c/; # Changes the 'a', but keeps the 'b'. s/b(?=a)/c/; # Changes the 'a', but keeps the 'b'. /^(?=.*a)(?=.*b)/; # Is equivalent to /a/ && /b/. /a(?:(?!bcd).)*e/; # (?:(?!...).)* is to regexp what # [^...] is to characters. # This example reads as: # "Match 'a' followed by somethng which # doesn't contain 'bcd', followed by 'e'."