0

I'm trying to restrict my username input field to be like that of Instagram's username field where it allows A-Z a-z and . and 0-9. I've tried a few regex JS examples but just can't get it to this point.

<label for="username">Username</label>
<input class="form-control" id="username" type="text" name="username">

This is what I have currently, can anyone help?

JMKelley
  • 599
  • 2
  • 17
  • 36
  • 2
    Could you be more specific on how exactly you expect the field to behave? "_tried a few regex JS examples_" implies some JavaScript code, but there is nothing alike in what you have posted... – ZorgoZ Dec 16 '18 at 16:59

1 Answers1

0

Can you post your Regex? There are a few ways to do validation of an input, but for something not too crazy like what you are requesting, I bet we can land on a solid Regex structure.

Just on my phone here, so not able to test super well but I am thinking something simple like:

[a-zA-Z\d\.]+