replaced deprecated StringBuffer with Builder
simplified matching based on Java Pattern (better compile times)