Replaced regex functions with ~ operator