Quantcast
Channel: Powershell – Jacques Dalbera's IT world
Viewing all articles
Browse latest Browse all 85

How to with Regular expressions

$
0
0

Hi, if you are using regular expressions, I recommend you the following tools and sites:

Regex tools to learn, build, test regular expressions:

http://regex.lumadis.be/test_regex.php?lang=fr

Tutorials about regexp:

http://en.wikipedia.org/wiki/Regular_expression

http://www.regular-expressions.info/quickstart.html

http://www.expreg.com/

 

Examples:

  • .at matches any three-character string ending with “at”, including “hat”, “cat”, and “bat”.
  • [hc]at matches “hat” and “cat”.
  • [^b]at matches all strings matched by .at except “bat”.
  • [^hc]at matches all strings matched by .at other than “hat” and “cat”.
  • ^[hc]at matches “hat” and “cat”, but only at the beginning of the string or line.
  • [hc]at$ matches “hat” and “cat”, but only at the end of the string or line.
  • \[.\] matches any single character surrounded by “[” and “]” since the brackets are escaped, for example: “[a]” and “[b]”.
  • s.* matches any number of characters preceded by s, for example: “saw” and “seed”.

regexp1 regexp2

 


Viewing all articles
Browse latest Browse all 85