add method for getting matched text