JavaScript Regular Expressionsโ
Some files are private or not ready yet, if a link gives you a 404 that's why :)
This is a work in progress, new notes will be added daily
List of note Indexes
-
๐ PROJECTS -
๐ ART -
๐ TECHNOLOGY -
๐ SCIENCE -
๐ PHILO-PSYCHO -
๐ HISTORY -
๐ HEALTH -
๐ GAMING -
๐ KNOWLEDGE
.... |\| .|||. |\/| .|\\. .|.
.\\||/|. .\|..|| .\|..|||...||.....
.| .....||.|\\\\\\ ... |\\\/. .\\. .||
.\\| .|\\|..|\\ .\\\\ .\\|. .\\\\\| |\| |\\|
|\\ |\\|.. /\\\. |\|\\ \\\\|. .|\\. .\\\\|
.\\. |\\\\\\\|.. .\\| .\\||\\/|. |\\| .|/\|
\. .\\\||/\|.... \\| |\/ |\\\ |\\\| .\\| \\| ....
|\/ |\\| |\\\\\\\| |\|.\\\ \\\\. |\\\\| |\\ \\. ||..
..|||\| .. .\\\\. |\\\\\\ .\\|....|\\\. |\\\\\\ |/. |/
\\\|.. .\\\ |\\. .\\\| \\| |||\\\. ...|\\/||. .\\\
|\| |\/. /\\\\\| .\\\\. \\. .../|. .|\\\|. |\\\| |\\
. |||\\|. ..||| .\\|. |\| \\|..../\\| |\\| .\\\\\ ..
\\| .||\|.|.. |\\\|./\ \\||\. ||... .\\\\/. |\/||
..|/||. |\\\\\|. .|/\| ||. .||\\\ .|||. |\
.\/| \\\. .|\\\|||\\\||.. .|\\\\\\\|\\\\. /\\\\||. |
.|| |\\\\| .......|\\\\\\. .\\\. ..|||.... .\\\\|.. ...
\\||....|\\\\\\\\||\\\\\\\/ |\|....|||\\\\\\\/....|\\\|
||.|\||\\| .....|\\\\..\\| .|\\\. ||........ .|\|...
. |\ /\\/\\\\\\. |\. .\\\\\\. ./\\\\/ |\\\||.
.|\.|\| .|\|... .. ./\\|..|\\| ..
.|\\| .\\\\.\\\\\\\ \||...\\\|..|\\\|.||
|\. ..||....|| ... ..||\\\. .|.
... .......
โ JavaScript | ๐ Regular Expressions
JavaScript - Regular Expressions
in JavaScript ๐ Regex are created using //
let string = 'This is a long string.'
let string2 = 'short string'
let regex = /This/
regex.test(string) // true
regex.test(string) // false
regex = /this/i // case insensitive
regex = /^this/ // "this" at the beggining of the string
regex = /this$/ // "this" at the end of the string
regex = /this./ // "this" + any character
regex = /this\./ // escaped so it will actually check for "this."
javascript
Regex bug
Calling regex.test() multiple times is bugged, especially when using a regex in a loop. To fix it set regex.lastIndex = 0 before each test.
See: es3-regexes-broken, tdlr: regex using /g doesn't have their regex.lastIndex reset.