(aka RegEx)
/ˈrɛɡɛks/ or /ˈrɛdʒɛks/
var str1 = "Chicken soup"
var str2 = "crispy chicken burger"
var str3 = "fish burger"
/chicken/i
Set of characters that represent RULES for SEARCHING or MATCHING text in a string
Regex
Subject
Because I'm sure you have used RegEx before. And if not, you should start using it
Flags change the default behaviour of your Regex
They are written after the ending forward slash
1. ignore case (i)
2. global (g)
3. multiline (m)
Characters with special meaning
\ ^ $ . | ? * + ( ) [ {
Note: Can be used as a literal character if preceded by a backslash
It matches a character from a specific set. Can be custom of predefined
CS of uppercase vowels [AEIOU]
CS of special characters [!@#$%^&*()_+]
CS of a range of characters from a-z [a-z]
CS of all alphabets (uppercase and lowercase) [a-zA-Z]
Note: The order of characters does not matter inside a character set
Note: The only metacharacters inside CS are \ - and ^
\d === [0-9]
\s === space character
\w === [a-zA-Z0-9_ ]
\D === [^0-9]
\S === [^\s]
\W === [^a-zA-Z0-9_ ]
+ 1 or more
* 0 or more
? 0 or 1
{ a specific number of times
Word Boundary \b
Beginning of subject ^
End of subject $
(Time permitting)
https://www.codeschool.com/courses/breaking-the-ice-with-regular-expressions