handle escaped character ranges properly