Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

powershell grab regex

# Grab regex group in powershell (e.g. version from string)
$STR="v0.1.1-prerelease-2"
$VERSION=[regex]::match($STR,'(0|[1-9]d*).(0|[1-9]d*).(0|[1-9]d*)').Groups[0].Value
# $VERSION will print 0.1.1
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #powershell #grab #regex
ADD COMMENT
Topic
Name
8+4 =