html5_validators icon indicating copy to clipboard operation
html5_validators copied to clipboard

Regexp support

Open kiote opened this issue 9 years ago • 1 comments

Hi @amatsuda and thanks for great gem!

I want to know do you have any plans to support Regexp in a future? Seems like this library really helps to avoid duplication between client and server, but with regexp I have to copy them anyway.

Or, maybe you have any advice for that?

I have for example, validation in backend with

value =~ /\A(4|9)\d{7}\Z/

and for frontend:

<%= f.telephone_field(:phone,
         placeholder: 'Mobile',
         pattern: '^[49]\d{7}$') %>

kiote avatar Feb 04 '16 13:02 kiote

that's a nice idea! :bulb: any reason why this haven't been implemented? :thinking: can I send a PR?

Ana06 avatar Apr 24 '19 15:04 Ana06