modified searchMatchingParen