Regex not working correctly

Hi i have this case

i got this regex {{ cedula.value.match(/^P$|^(?:PE|E|N|[23456789]|[23456789](?:A|P)?|1[0123]?|1[0123]?(?:A|P)?)$|^(?:PE|E|N|[23456789]|[23456789](?:AV|PI)?|1[0123]?|1[0123]?(?:AV|PI)?)-?$|^(?:PE|E|N|[23456789](?:A)?|1[0123]?(?:AV|PI)?)-(?:\d{1,4})-?$|^(PE|E|N|[23456789](?:AV|PI)?|1[0123]?(?:AV|PI)?)-(\d{1,4})-(\d{1,6})$/) == null ? "Ingresa un número de cédula válido" : "" }}

in theory it should send that message when regex is not matching with the field value but still shows the default retool error.

what im missing? thank you

That looks like an overcomplicated regex check... what are you trying to compare the value to?

thats the regex for our ID in Panama have format like 8-789-7898 pe-788-788 etc i mean it works but doesnt show my custom validation message, shows the default retool one

Instead of RegEx try putting the same information in a custom rule?
Screenshot 2023-11-15 at 9.05.41 AM


thats the trick, thank you works good !

1 Like