Skip to content

shreyaschavhan/regex-notes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

30 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โ ๐‘๐ž๐ ๐ž๐ฑ ๐๐จ๐ญ๐ž๐ฌ

Best Reources:

Practice:

๐„๐ฌ๐œ๐š๐ฉ๐ž ๐‚๐ก๐š๐ซ๐š๐œ๐ญ๐ž๐ซ๐ฌ

You should always escape these characters: .[{()\^|?*+
Backslash is used to escape characters

For Example: 
. - selects everything
\. - matches literal dot

You have to also escape a backslash itself i.e. \\ will result in \

๐Œ๐š๐ญ๐œ๐ก๐ž๐ฌ ๐‚๐ก๐š๐ซ๐š๐œ๐ญ๐ž๐ซ๐ฌ

Key Meaning
. Any character except new line
\d Digit (0-9)
\D Not a Digit (0-9)
\w Word Characters (a-z, A-Z, 0-9)
\W Not a word character
\s Whitespace (space, tab, newline)
\S Not Whitespace (space, tab, newline)

๐€๐ง๐œ๐ก๐จ๐ซ๐ฌ - ๐Œ๐š๐ญ๐œ๐ก๐ž๐ฌ ๐ฏ๐ข๐ฌ๐ข๐›๐ฅ๐ž ๐ฉ๐จ๐ฌ๐ข๐ญ๐ข๐จ๐ง๐ฌ ๐›๐ž๐ญ๐ฐ๐ž๐ž๐ง ๐œ๐ก๐š๐ซ๐š๐œ๐ญ๐ž๐ซ๐ฌ

Key Meaning
\b Word boundary
\B Not a word boundary
^ Beginning of a string
$ End of a string

??

Key Meaning
[ ] Matches characters in brackets
[^ ] Matches characters NOT in brackets
| Either Or
() Group

๐๐ฎ๐š๐ง๐ญ๐ข๐Ÿ๐ข๐ž๐ซ๐ฌ

Key Meaning
* 0 or more
+ 1 or more
? 0 or one
{3} exact number
{3,4} range of numbers (minimum, maximum)

Other notes:

  • To exclude a string: ^(?!pattern_to_exclude).*$

About

My Notes on Regular Expressions for AWAE/OSWE.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published