1 00:00:00,220 --> 00:00:06,560 Notice this string I typed in the last video, wwwgoogle.com. 2 00:00:06,560 --> 00:00:09,722 Even though we've grouped the www dot together, 3 00:00:09,722 --> 00:00:14,270 the regex is still finding a partial match in this test string. 4 00:00:14,270 --> 00:00:18,000 As you can see, it does this by starting to match the pattern, 5 00:00:18,000 --> 00:00:20,720 later in the string, at the fourth character. 6 00:00:20,720 --> 00:00:24,153 We can see the opposite problem by typing another test string, 7 00:00:24,153 --> 00:00:26,048 with extra characters at the end. 8 00:00:28,310 --> 00:00:33,550 If we're trying to match Google.com, neither of these strings are valid. 9 00:00:33,550 --> 00:00:37,970 We can tell the parser to only consider these a match if the entire string 10 00:00:37,970 --> 00:00:42,120 fits our pattern, and to reject partial matches like these. 11 00:00:42,120 --> 00:00:45,290 You will see these characters often in regex's. 12 00:00:45,290 --> 00:00:47,140 They are very useful in ensuring, 13 00:00:47,140 --> 00:00:51,340 you are only matching at the beginning or ending of a string. 14 00:00:51,340 --> 00:00:54,720 While other regex characters have represented characters and 15 00:00:54,720 --> 00:00:58,110 strings, these only represent location. 16 00:00:59,250 --> 00:01:01,430 As I mentioned in the first video, 17 00:01:01,430 --> 00:01:05,580 make sure you have this checked, match at line breaks. 18 00:01:05,580 --> 00:01:10,705 This lets us treat each line as a separate test string rather than one block. 19 00:01:10,705 --> 00:01:15,980 To tell the parser to only start matching at the beginning of test strings 20 00:01:15,980 --> 00:01:18,780 I'll put a caret at the beginning of the regex. 21 00:01:19,930 --> 00:01:24,530 You see, that excluded wwwgoogle.com because 22 00:01:24,530 --> 00:01:28,440 if www is present, it must be followed by a dot. 23 00:01:29,480 --> 00:01:32,850 Now to specify the string must end with net or 24 00:01:32,850 --> 00:01:37,660 com, with only one m, I'll put a dollar sign at the end of the expression. 25 00:01:38,910 --> 00:01:41,970 Now all of the valid strings are matched. 26 00:01:41,970 --> 00:01:46,340 You'll probably use a carat and dollar sign often in your regular expressions to 27 00:01:46,340 --> 00:01:49,950 eliminate strings that contain the pattern you're matching, but 28 00:01:49,950 --> 00:01:53,040 as a whole would be considered invalid. 29 00:01:53,040 --> 00:01:56,860 Find some additional practice in the teacher's notes below. 30 00:01:56,860 --> 00:02:00,750 Next, let's start using everything we've learned in a real project.