Home > Software design >  Remove chars before first digit in Powershell
Remove chars before first digit in Powershell

Time:04-04

I need to write a PowerShell script which will remove characters before a digit. Example: input is "...das.as.1.2.3" or "v.1.2.3" output should be: "1.2.3"

have zero experience in powershell scripting

CodePudding user response:

PS C:\> "...das.as.1.2.3" -replace '^\D '
1.2.3

A regular expression to replace anything which is not-a-digit chars, from the beginning of the string.

  • Related