PascaleBeier / bootstrap-validate

A simple Form Validation Utility for Bootstrap 3 and Bootstrap 4 for Humans.
https://bootstrap-validate.js.org
MIT License
136 stars 54 forks source link

Regex Validation Issue - Pipe operator "|" is used as rule separator #126

Open dominicklee opened 2 years ago

dominicklee commented 2 years ago

Hello, I am having an issue with using Bootstrap Validate for my regex. I must be able to use the pipe operator as part of my regex syntax. Can you please show any alternative to achieve the following:

regex:([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-5][0-9])\s*([AaPp][Mm]):Please enter a valid time

I want to be able to validate text that says "10:30 am" or "9:00am"

Because of the pipe operator. "|" is used as rule separator.

Originally posted by @PascaleBeier in https://github.com/bootstrap-validate/bootstrap-validate/issues/50#issuecomment-516749943

PascaleBeier commented 2 years ago

Hey, thanks for reaching out. This is a limitation of this library and will not be able tackled in the near future. You could use input masking too, e.g. https://imask.js.org/