How to check if a string contains a number in powershell
10,608
Use a regular expression match:
'paul123' -match '\d'
\d
matches a digit (0-9), so the expression will evaluate to true if the string contains at least one digit.
Author by
Naveen Goyal
Updated on June 04, 2022Comments
-
Naveen Goyal over 1 year
How do I check if a string contains any numeric value.
Ex: paul123
The above example contains numeric value so I should get the output as true.