Wednesday, November 17, 2021

Regex Cheat Sheet

1.  Matching a set of words :  Hello Brick, Brik data ,Brck -->. Bri?c?k.  


More:

^ 

Start                            

$

End                            


a?

one or more a                            


(?i)

case insensitive                        


a{3}

exactly 3 of  a                            


a{3,6}

between 3 and 6 of  a                            



(.*)(?i)(tech?i?e)(.*?) 

        tech, techi, techie, techie house, the techie house                          

\d    

Any digit, short for [0-9]

\D

A non-digit, short for [^0-9]

\s

A whitespace character, short for [ \t\n\x0b\r\f]

\S

A non-whitespace character, short for

\w

A word character, short for [a-zA-Z_0-9]

\W

A non-word character [^\w]

\S+

Several non-whitespace characters

\b   

Matches a word boundary where a word character is [a-zA-Z0-9_]                         


           

^\d{4}\sHELLO\s     

1234 HELLO some-other words

\S

A non-whitespace character, short for

\w

A word character, short for [a-zA-Z_0-9]

\W

A non-word character [^\w]

\S+

Several non-whitespace characters

\b   

Matches a word boundary where a word character is [a-zA-Z0-9_]                


Try out:  https://regex101.com/


No comments:

Post a Comment