Thanks for your answers. They helped me to realize that I was mistakenly using match.string (the whole string) when I should be using math.group(0) (the whole match). Best regards, Javier