+ All Categories
Home > Technology > SE Michigan PowerShell Users Group - Regex Part1

SE Michigan PowerShell Users Group - Regex Part1

Date post: 24-May-2015
Category:
Upload: southeast-michigan-powershell-script-club
View: 1,632 times
Download: 1 times
Share this document with a friend
Popular Tags:
21
Matt Johnson SE Michigan PowerShell Script Club [email protected]
Transcript
Page 1: SE Michigan PowerShell Users Group -  Regex Part1

Matt JohnsonSE Michigan PowerShell Script Club

[email protected]

Page 2: SE Michigan PowerShell Users Group -  Regex Part1

Introduction Simple Pattern Searches Simple Pattern Examples Introduction to Regular Expressions Closing

Page 3: SE Michigan PowerShell Users Group -  Regex Part1
Page 4: SE Michigan PowerShell Users Group -  Regex Part1
Page 5: SE Michigan PowerShell Users Group -  Regex Part1

Used with both operating system commands and PowerShell commands.

Using cmd.exe we used “*” and “?”. With PowerShell we get a few more options.

Also work with -like and –notlike

Page 6: SE Michigan PowerShell Users Group -  Regex Part1

Simple Pattern Wildcards

Turns out this is a basic form of regular expressions

Wildcard Description

* Any number of characters

? Exactly one character

[xyz] One of the specified characters

[x-z] One of the characters in the specified area

Page 7: SE Michigan PowerShell Users Group -  Regex Part1
Page 8: SE Michigan PowerShell Users Group -  Regex Part1

Dir *.txt

Dir [li]*

$ip = 192.168.23.1If ($ip –like “*.*.*.*”) {“Valid”} Else {“Invalid”}

Page 9: SE Michigan PowerShell Users Group -  Regex Part1
Page 10: SE Michigan PowerShell Users Group -  Regex Part1

From Wikipedia: “Regular expressions provide a concise and flexible means for identifying strings of text of interest, such as particular characters, words, or patterns of characters.”

Found in some programming / scripting languages, editors and utilities.

Page 11: SE Michigan PowerShell Users Group -  Regex Part1

Programming Languages: PowerShell, Perl, .NET languages, C++

Editors: Visual Studio, emacs

Utilities: grep, Power Grep

Page 12: SE Michigan PowerShell Users Group -  Regex Part1

Websites:◦ http://www.regular-expressions.info/

Page 13: SE Michigan PowerShell Users Group -  Regex Part1

Websites:◦ www.regexlib.com

Page 14: SE Michigan PowerShell Users Group -  Regex Part1

Websites:◦ MSDN Regex Class

Page 15: SE Michigan PowerShell Users Group -  Regex Part1

Books◦ Mastering Regular Expressions by Jeffrey Friedl◦ Regular Expressions Cookbook by Jan Goyvaerts,

Steven Levithan

Page 16: SE Michigan PowerShell Users Group -  Regex Part1

Applications◦ Rad Software Regular Expression Designer◦ http://www.radsoftware.com.au

Page 17: SE Michigan PowerShell Users Group -  Regex Part1

Applications◦ Ultrapico Expresso 3.0◦ http://www.ultrapico.com/expresso.htm

Page 18: SE Michigan PowerShell Users Group -  Regex Part1

Applications◦ The Regex Coach◦ http://weitz.de/regex-coach

Page 19: SE Michigan PowerShell Users Group -  Regex Part1
Page 20: SE Michigan PowerShell Users Group -  Regex Part1

PowerShell and Regular expressions PowerShell and .NET’s Regex class Regular Expression Examples

Page 21: SE Michigan PowerShell Users Group -  Regex Part1

Contact Me:Matt Johnson, GSEC, MCSEEmail: [email protected]:

http://www.packetcrazy.com/blogSocial Sites: mwjcomputing

- Twitter, Friendfeed, Facebook


Recommended