VehiclesFashionRecipesBlogsHuntTravelsSportFunHandmadeITEducation
Mini-Games
x

x
zakruti.com » IT - Software » freeCodeCamp.org
Learn Regular Expressions (Regex) - Crash Course for Beginners

Learn Regular Expressions (Regex) - Crash Course for Beginners

FBTwitterReddit

video description

Rating: 4.0; Vote: 1
Regular expressions (or Regex) are patterns used to match character combinations in strings. In this crash course tutorial, you will learn how to use regular expressions in JavaScript. You will be able to apply the concepts to any programming language. This course follows along with the free regular expressions curriculum at freeCodeCamp.org: https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/regular-expressions You can also view this course on Scrimba.com: https://scrimba.com/g/gregularexpressions -- Contents -- -- (01:04) Using the Test Method -- (02:15) Match Literal Strings -- (02:57) Match a Literal String with Different Possibilities -- (03:46) Ignore Case While Matching -- (04:45) Extract Matches -- (05:32) Find More Than the First Match -- (07:16) Match Anything with Wildcard Period -- (08:54) Match Single Character with Multiple Possibilities -- (10:14) Match Letters of the Alphabet -- (10:04) Match Numbers and Letters of the Alphabet -- (12:15) Match Single Characters Not Specified -- (13:32) Match Characters that Occur One or More Times -- (14:19) Match Characters that Occur Zero or More Times -- (15:32) Find Characters with Lazy Matching -- (18:54) Find One or More Criminals in a Hunt -- (19:58) Match Beginning String Patterns -- (20:53) Match Ending String Patterns -- (21:40) Match All Letters and Numbers -- (22:48) Match Everything But Letters and Numbers -- (23:35) Match All Numbers -- (24:04) Match All Non-Numbers -- (24:40) Restrict Possible Usernames -- (27:29) Match Whitespace -- (27:56) Match Non-Whitespace Characters -- (28:25) Specify Upper and Lower Number of Matches -- (29:40) Specify Only the Lower Number of Matches -- (30:10) Specify Exact Number of Matches -- (30:47) Check for All or None -- (31:38) Positive and Negative Lookahead -- (35:09) Reuse Patterns Using Capture Groups -- (40:18) Use Capture Groups to Search and Replace -- (43:18) Remove Whitespace from Start and End - Course created by Beau Carnes. Follow Beau on
Date: 2022-03-14

Comments and reviews: 10


01:04 Using the Test Method-
02:15 Match Literal Strings-
02:57 Match a Literal String with Different Possibilities-
03:46 Ignore Case While Matching-
02:46 Extract Matches-
05:33 Find More Than the First Match-
07:16 Match Anything with Wildcard Period-
08:54 Match Single Character with Multiple Possibilities-
10:15 Match Letters of the Alphabet-
11:04 Match Numbers and Letters of the Alphabet-
12:15 Match Single Characters Not Specified-
13:33 Match Characters that Occur One or More Times-
14:19 Match Characters that Occur Zero or More Times-
15:32 Find Characters with Lazy Matching-
18:54 Find One or More Criminals in a Hunt-
19:58 Match Beginning String Patterns-
20:56 Match Ending String Patterns-
21:39 Match All Letters and Numbers-
22:47 Match Everything But Letters and Numbers-
23:35 Match All Numbers-
24:06 Match All Non-Numbers-
24:40 Restrict Possible Usernames-
27:28 Match White-space-
27:56 Match Non-White-space Characters-
28:26 Specify Upper and Lower Number of Matches-
29:40 Specify Only the Lower Number of Matches-
30:10 Specify Exact Number of Matches-
30:46 Check for All or None-
31:37 Positive and Negative Lookahead.....Check For Mixed Grouping of Characters-
35:09 Reuse Patterns Using Capture Group-
40:18 Use Capture Groups to Search and Replace-
43:17 Remove Whitespace from Start and End

reply

-FOR REFERENCE-:------
\f matches form-feed.-
\r matches carriage return.-
\n matches linefeed.-
\t matches horizontal tab.-
\v matches vertical tab.-
\0 matches NUL character.-
[\b] matches backspace.-
\s matches whitespace (short for [\f\n\r\t\v\u00A0\u2028\u2029] ).-
\S matches anything but a whitespace (short for [-\f\n\r\t\v\u00A0\u2028\u2029] ).-
\w matches any alphanumerical character (word characters) including underscore (short for [a-zA-Z0-9_] ).-
\W matches any non-word characters (short for [-a-zA-Z0-9_] ).-
\d matches any digit (short for [0-9] ).-
\D matches any non-digit (short for [-0-9] ).-
\b matches a word boundary (the position between a word and a space).-
\B matches a non-word boundary (short for [-\b] ).-
\cX matches a control character. E.g: \cm matches control-M .-
\xhh matches the character with two characters of hexadecimal code hh .-
\uhhhh matches the Unicode character with four characters of hexadecimal code hhhh .

reply

Thanks for the video, but I think you are mistaken or misspoke on the reuse pattern using capture group. You stated that if you replace the \1 with the same capture pattern that it would be the same thing. I believe that is a mistake, for example use repeatstring. If you replaced the \1 with (\w+) then Yes it would match the string, but it would also match -regex testing- and I don-t think that is what you are trying to do.
reply

This is certainly an informative video however it is not a beginner's video due to how fast paced it is and the assumption that some prerequisite knowledge is present. In this case JavaScript. Nonetheless it is a good tutorial for people who want to refresh their knowledge on this particular area.
reply

quick question regarding the lookaheads example.
let pwRegex = /(?=\w-5-)(?=\D-\d-2-)/;
In the above regex , Beau mentions using '\D-' in the second sub-pattern.
im not understanding WHY thats being used !
anyone know what the purpose of '\D-' is and why its there ??

reply

I think at 36:40 there is mistake.
He says that replacing \1 is just to avoid rewriting (\w+)
However
/(\w+)\s\1/ tests TRUE for -regex regex- but FALSE or -regex somethingelse-
/(\w+)\s(\w+)/ tests TRUE for -regex regex- but TRUE for -regex somethingelse-

reply

34:48 For anyone confused why he didn't put a comma after the 2 for -two -or more-- it-s because it is in a lookahead: it only needs to see two digits and then it can stop looking because then we know there are at least two.
reply

at Restrict Possible Usernames 24:40
if the string is three characters (one letter and two numbers ) it will get false
so the expression should be /-[A-Za-z]-2,-\d-$ --[A-Za-z]-1,-\d-2,-$/

reply

the solution at 34:58 is not correct and the original challenge throws an error if I use 5 instead of 6 when testing string '12345'. let me know if this is a misunderstanding -
reply

Step 1- learn regex
Step 2- forget regex
Step 3- realize you still need to know regex, frantically try combinations on regexr until you get what you need.

reply
Add a review, comment






Other channel videos