edited for pretty print and added regex