I have a requirement to find and extract a number contained within a string.
For example, from these strings:
string test = \"1 test\" string test1 =
Using @tim-pietzcker answer from above, the following will work for PowerShell.
PowerShell
PS C:\> $str = '1 test' PS C:\> [regex]::match($str,'\d+').value 1