ConsTrain with regular expression patterns JavaScript and PHP Forms JavaScript Forms


show more Constraining with regular expression patterns provides you with in-depth training on Developer. Taught by Ray Villalobos as part of the Validating and Processing Forms with JavaScript and PHP show less
please wait ...

Constraining with regular expression patterns

HTML5 input fields have a super cool attribute called Pattern, which you can use inside fields to check the user's input against a specific set of characters. Inside this attribute, you define a string that prevents the form from submitting unless the text in the input field matches the pattern. The language we use to format our string is called a regular expression. And they're common to a variety of programming languages. Let's take a look at how this works. I have a very simple form here with a single field that expects you to type in a correct pattern.

So let's go to the code for this. And I'm going to add the Pattern attribute to this field. Now I'm going to add some literal text here. Texas and save this. Go back into my form, make sure I refresh, and I'm going to try to type something into the form. I'll try California. And when I hit Enter, I get a popup that says to please match the requested format. So I'm going to try typing T...

Constraining with regular expression patterns
Video duration: 6m 59s 2h 51m Intermediate

Viewers:

Constraining with regular expression patterns provides you with in-depth training on Developer. Taught by Ray Villalobos as part of the Validating and Processing Forms with JavaScript and PHP

Subjects:
Developer Web
Software:
JavaScript PHP
Author:
please wait ...