pil: improved patch regular expression