1 00:00:00,630 --> 00:00:06,410 Notice the string I typed in the last video, wwwgoogle.com. 2 00:00:06,410 --> 00:00:09,440 Even though we've grouped the www dot together, 3 00:00:09,440 --> 00:00:14,390 the regex is still finding a partial match in this test string. 4 00:00:14,390 --> 00:00:19,920 As you can see, it does this by starting to match the pattern later in the string, 5 00:00:19,920 --> 00:00:21,850 at the fourth character. 6 00:00:21,850 --> 00:00:26,501 We can see the opposite problem by typing another test string with extra 7 00:00:26,501 --> 00:00:28,062 characters at the end. 8 00:00:30,434 --> 00:00:34,870 Google.com with a couple extra m's. 9 00:00:34,870 --> 00:00:39,840 If we're trying to match google.com, neither of these strings are valid. 10 00:00:39,840 --> 00:00:44,720 We can tell the parser to only consider these a match if the entire string 11 00:00:44,720 --> 00:00:49,330 fits our pattern and to reject partial matches like these. 12 00:00:50,430 --> 00:00:54,250 You'll see these characters often in regular expressions. 13 00:00:54,250 --> 00:00:59,190 They are very useful in ensuring that you're only matching at the beginning or 14 00:00:59,190 --> 00:01:00,980 ending of a string. 15 00:01:00,980 --> 00:01:06,474 While other reg ex characters have represented characters in strings, 16 00:01:06,474 --> 00:01:09,003 these only represent location. 17 00:01:09,003 --> 00:01:13,630 As I mentioned in the first video, make sure you have the m flags set. 18 00:01:13,630 --> 00:01:19,060 This lets us treat each line as a separate string, rather than one block. 19 00:01:19,060 --> 00:01:23,596 To tell the parser to only start matching at the beginning of a test string, 20 00:01:23,596 --> 00:01:26,479 I'll put a caret at the beginning of the regex. 21 00:01:29,188 --> 00:01:32,813 You see that excluded wwwgoogle.com, 22 00:01:32,813 --> 00:01:37,830 because if www is present, it must be followed by a dot. 23 00:01:38,840 --> 00:01:43,617 Now, to specify that the string must end with .net or 24 00:01:43,617 --> 00:01:49,976 .com with only one m, I put a dollar sign at the end of the expression. 25 00:01:49,976 --> 00:01:53,270 Now all the valid strings are matched. 26 00:01:53,270 --> 00:01:58,100 You'll probably use the caret and dollar sign often in your regular expressions 27 00:01:58,100 --> 00:02:02,050 to eliminate strings that contain the pattern you're matching. 28 00:02:02,050 --> 00:02:05,750 But as a whole would be considered invalid. 29 00:02:05,750 --> 00:02:07,610 For some additional practice, 30 00:02:07,610 --> 00:02:10,540 once again check the notes associated with this video.