Search
 
SCRIPT & CODE EXAMPLE
 

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
Comment

powershell regex

d digit [0-9]
w alpha numeric [a-zA-Z0-9_]
s whitespace character
.  any character except newline
() sub-expression
  escape the next character
Comment

PREVIOUS NEXT
Code Example
Shell :: moodle update cli 
Shell :: nginx install ssl certificate centos 
Shell :: setup ssh key 
Shell :: git tag documentation 
Shell :: powershell set environment variable and run command 
Shell :: fix corrupt pdf command line 
Shell :: selinux 
Shell :: virtualbox boot from usb 
Shell :: mv linux command 
Shell :: count file linux 
Shell :: pacman search 
Shell :: ubuntu enable network manager 
Shell :: create rails app 
Shell :: git commit exluding one file 
Shell :: vim delete word without yank 
Shell :: get total github lines 
Shell :: jenkins builds 
Shell :: git push to new branch 
Shell :: pylint 
Shell :: scp send file to remote 
Shell :: git rebase i 
Shell :: terraform 
Shell :: vba run shell command with arguments 
Shell :: delete all files in a folder linux 
Shell :: powershell decompress zip 
Shell :: mac workbench error loading schema content 1558 
Shell :: How to ssh to multiple servers and run commands 
Shell :: doker desktop ffailed to initailise 
Shell :: consolidated version yarn.lock 
Shell :: zotero linux chromeos 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =