regex: clean up position accounting for literal nodes