s/ $STRING $PATTERN /$REPLACEMENT/gx # where STRING and PATTERN are user-defined