regular expression matching with cpp code