user5740843 user5740843 - 1 year ago 69
HTML Question

Restricting form input goes haywire

I'm trying to restrict form input in a form that I have. The particular input is for an ID that has very specific requirements. An example of which would be:


The code I'm working with to restrict it is:


<input type="text" class="form-control" id="nid"
name="nid" placeholder="@lang('app.nid')"
value="" />
<button type="submit">

And I can't seem to make it accept it. It seems refuses any input I give, both the bad and the supposibly good.

Can anyone help me figure out why?

Answer Source

It's because of those + in your regex. Not sure what you want there, but if you remove those it works. Those plus signs make your regex invalid.

Another problem was the - you escaped. This caused the regex not to work as well:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download