Reputation: 859
Struggling to get the correct formatting for a regex which will accept any number or N/A any other value would fail validation. The following did not work. My regex is less than average...
<input type="text" record="job" name="quote_design_hours" size="6" pattern="[0-9|N/A]" title="Value must be a number or N/A" value="">
Upvotes: 0
Views: 1207
Reputation: 811
Your pattern should be (N/A|[0-9]+)
The reasoning is:
|
(you can use non-matching groups with (?: ... | ... )
insteadN/A
[0-9]
(i.e. any character from 0
to 9
), and can be present one or more times (+
)Upvotes: 1