A Regular Expression (RegEx, regex, regexp, RE, etc.) is a way to search through strings. It helps in doing validation, getting/matching certain pieces of a string, finding and replacing strings and more.
/
. Eg:
/selena/
""
or
''
.
/
and it can be
g
: global
i
: case insensitivem
: multi lines
: single line (dotall)u
: unicodey
: sticky"str".match(RegEx)
to find all matching patterns
(RT: array)
"str".search(RegEx)
to test for a single match (RT:
index posn of first match)
"str".replace(RegEx, "text")
to replace all
matching patterns
"str".test(RegEx)
to test whether pattern(s) were
found or not (RT: boolean)