Difference between revisions of "Regular Expressions"

Jump to navigation Jump to search
508 bytes added ,  14:18, 18 February 2011
→‎Examples: Added "Script Version"
(→‎Useful/Standard RegEx: Added Multiple whitespace)
(→‎Examples: Added "Script Version")
Line 70: Line 70:
# <code>\s?</code>
# <code>\s?</code>
#* Matches any white-space at the end of the match
#* Matches any white-space at the end of the match
=== Script Version ===
'''<code>(?<=v)[0-9]+(\.[0-9])+(?=.)</code>'''
Gets the script version number off the end of a script name
* EG Get <code> 1.2.3 </code> from <code>Script-v1.2.3.ps1</code>
Stepping through the regex...
# <code>(?<=v)</code>
#* Requires that <code>v</code> immediately precedes the match
# <code>[0-9]+</code>
#* Matches one or more digits
# <code>(\.[0-9])+</code>
#* Matches <code>.n</code> one or more times
# <code>(?=.)</code>
#* Requires that <code>.</code> follows the match

Navigation menu