1 00:00:00,380 --> 00:00:02,710 In the comments, you can see the requirements for 2 00:00:02,710 --> 00:00:04,100 the phone number validation. 3 00:00:05,270 --> 00:00:07,640 Go ahead and pause this video, 4 00:00:07,640 --> 00:00:12,060 see if you can complete this function before I show you my solution. 5 00:00:12,060 --> 00:00:18,040 One quick reminder though, don't forget that parentheses are special characters. 6 00:00:18,040 --> 00:00:21,280 So to indicate you want to match those literal characters, 7 00:00:21,280 --> 00:00:27,450 you need to escape them with a backslash, like this or like that. 8 00:00:29,250 --> 00:00:31,770 Here's how I broke down this problem. 9 00:00:31,770 --> 00:00:36,998 I see three groups of numbers, two groups of three and one group of four. 10 00:00:39,093 --> 00:00:40,745 So I'll type return. 11 00:00:44,395 --> 00:00:45,912 And three groups. 12 00:00:49,411 --> 00:00:51,050 And one group of four. 13 00:00:51,050 --> 00:00:54,990 There are some characters that we want the user to type in though. 14 00:00:54,990 --> 00:00:56,860 Parentheses around the first group. 15 00:00:58,120 --> 00:01:02,040 So, \ (, and 16 00:01:02,040 --> 00:01:07,167 \), a space, and -. 17 00:01:09,040 --> 00:01:11,890 And we don't want any other characters at the beginning or end. 18 00:01:11,890 --> 00:01:14,700 So I'll put a ^ and $ at either end. 19 00:01:19,416 --> 00:01:22,860 And we'll test, and pass in telephone. 20 00:01:24,910 --> 00:01:28,881 Save, and if I test this out in the browser, 21 00:01:37,013 --> 00:01:38,900 We can see it works! 22 00:01:38,900 --> 00:01:42,960 Asking a user to format a phone number is unnecessary though. 23 00:01:42,960 --> 00:01:48,030 I'll show you how you can format the phone number automatically in a future video. 24 00:01:48,030 --> 00:01:50,320 Next let's validate the email address.