Regular expression construct for matching beginning and end of symbol