-
Notifications
You must be signed in to change notification settings - Fork 1
Nodejs syntax
David Liu edited this page Dec 29, 2023
·
12 revisions
- use shebang
#!/usr/bin/env nodein nodejs source code - References
- If you need to know if a string matches a regular expression RegExp, use RegExp.prototype.test().
- If you only want the first match found, you might want to use RegExp.prototype.exec() instead.
- If you want to obtain capture groups and the global flag is set, you need to use RegExp.prototype.exec() or String.prototype.matchAll() instead.
- String.prototype.match() won't return groups if the /.../g flag is set. However, you can still use String.prototype.matchAll() to get all matches.
- If you want to match a repeated pattern (e.g. substring) but don't want to have it in captured group, use Non-capturing-group syntax
(?:pattern)