Triplet slur: s/(3\([A-Ga-g][A-Ga-gz',]*\) /(3(\1) /g Isolated note: / [A-Ga-gz][',=']* / Two notes that should maybe be separated: /[A-Ga-g,)][A-Ga-g,)]2/ Two notes tied -> slurred s/\([A-Ga-g][,']*[2-9\/]*[<>]*\)- *\([<>]*[(A-Ga-g][,']*[2-9\/]*\)/(\1\2)/