Regular expression Pattern, minimum 1 blank space

Asked

Viewed 928 times

1

I have a form with an input field and Pattern attribute that is allowed uppercase and lowercase letters, but also need to have at least one blank space (mandatory) and more space occurrences at will.

1 answer

0

Blank space [\s] at least one {1,}

<form name="form" action="/unanswered">
<input type="text" name="name" class="field" required pattern="[\wà-úÀ-Ú ]+[\s]{1,}/?[\wà-úÀ-Ú ]*" />
<input type="submit" value="vai">
</form>

  • Hi Leo, it only worked q the mandatory space was at the end, I tried with your code through the middle but could not.

  • It hasn’t worked yet Leo, I’m almost giving up on this and doing something with Javascript or two input fields, but your answer has been very useful to be applied in other ways, I thank you for the time and support

  • @Wellingtonpragidi, then, which situation does not work now?

  • This code that you edited made mandatory the space in the right middle Leo, only now is no longer accepting the accent that I had done before

Browser other questions tagged

You are not signed in. Login or sign up in order to post.