Advertisement - contains affiliate link

Regular expressions can be used to define specific search patterns. In most cases they can be used for operations like “search and replace”. Due to the fact that they are highly customizable, they are a very useful tool for every developer. The huge advantage of these Regular Expressions is that they can be defined very specifically and so they can be adapted to your needs perfectly. I just want to show you some basic operations to get an idea of this thing. If you are interested in testing them out and practicing to improve your skills, you can simply use this awesome tool to get started using Regular Expressions (RegEx):
https://regex101.com/

Advertisement - contains affiliate link
Firstly, there are some basic operators:
^Hack -> This would match any strings starting with "Hack"
buddies$ ->  This would match any strings ending with "buddies" 

If you want to match any characters between for example a-z:
[a-z] -> matches any small character
[A-Z] -> matches any big character 
[a-zA-Z] -> matches any character

You can also define how often the character or string shall appear:
a? -> matches zero or one "a"
a* -> matches zero or more "a"
a+ -> matches one or more "a"
a{5} -> exactly 5 times "a"
a{5,} -> 5 or more times "a"
a{1,5} -> Between 1 and 5 times "a" 

If you want to match everything within round brackets:
(.*?) 

There are so many applications and possibilities for using Regular Expressions (RegEx). Just try it out and let me know if you built some cool search patterns which are maybe unique and useful! I will add them to the post afterwards. For example you can use them in one of our PowerShell scripts, let’s say to filter for specific group names like here

Advertisement - contains affiliate link

LEAVE A REPLY

Please enter your comment!
Please enter your name here