Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

SE Michigan PowerShell Users Group - Regex Part1


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

SE Michigan PowerShell Users Group - Regex Part1

  1. 1. Matt Johnson SE Michigan PowerShell Script Club [email_address]
  2. 2. <ul><li>Introduction </li></ul><ul><li>Simple Pattern Searches </li></ul><ul><li>Simple Pattern Examples </li></ul><ul><li>Introduction to Regular Expressions </li></ul><ul><li>Closing </li></ul>
  3. 5. <ul><li>Used with both operating system commands and PowerShell commands. </li></ul><ul><li>Using cmd.exe we used “*” and “?”. With PowerShell we get a few more options. </li></ul><ul><li>Also work with -like and –notlike </li></ul>
  4. 6. <ul><li>Simple Pattern Wildcards </li></ul><ul><li>Turns out this is a basic form of regular expressions </li></ul>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
  5. 8. <ul><li>Dir *.txt </li></ul><ul><li>Dir [li]* </li></ul><ul><li>$ip = If ($ip –like “*.*.*.*”) {“Valid”} Else {“Invalid”} </li></ul>
  6. 10. <ul><li>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.” </li></ul><ul><li>Found in some programming / scripting languages, editors and utilities. </li></ul>
  7. 11. <ul><li>Programming Languages: PowerShell, Perl, .NET languages, C++ </li></ul><ul><li>Editors: Visual Studio, emacs </li></ul><ul><li>Utilities: grep, Power Grep </li></ul>
  8. 12. <ul><li>Websites: </li></ul><ul><ul><li> </li></ul></ul>
  9. 13. <ul><li>Websites: </li></ul><ul><ul><li> </li></ul></ul>
  10. 14. <ul><li>Websites: </li></ul><ul><ul><li>MSDN Regex Class </li></ul></ul>
  11. 15. <ul><li>Books </li></ul><ul><ul><li>Mastering Regular Expressions by Jeffrey Friedl </li></ul></ul><ul><ul><li>Regular Expressions Cookbook by Jan Goyvaerts, Steven Levithan </li></ul></ul>
  12. 16. <ul><li>Applications </li></ul><ul><ul><li>Rad Software Regular Expression Designer </li></ul></ul><ul><ul><li> </li></ul></ul>
  13. 17. <ul><li>Applications </li></ul><ul><ul><li>Ultrapico Expresso 3.0 </li></ul></ul><ul><ul><li> </li></ul></ul>
  14. 18. <ul><li>Applications </li></ul><ul><ul><li>The Regex Coach </li></ul></ul><ul><ul><li> </li></ul></ul>
  15. 20. <ul><li>PowerShell and Regular expressions </li></ul><ul><li>PowerShell and .NET’s Regex class </li></ul><ul><li>Regular Expression Examples </li></ul>
  16. 21. <ul><li>Contact Me: Matt Johnson, GSEC, MCSE Email: [email_address] Blog: Social Sites: mwjcomputing - Twitter, Friendfeed, Facebook </li></ul>