Link to home
Start Free TrialLog in
Avatar of enjama
enjama

asked on

Powershell or Regex?

Hi people -

Just curious -
look at the following expression in powershell.  Why does this return true?  I believe the limit here is 3, NO?

"8888888888888888888" -match "[0-9]{0,3}"
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of enjama
enjama

ASKER

As a result of this comment, my regex went from

"888-367-1240" -match "[0-9]{3,3}-[0-9]{3}-[0-9]{4}"

to

"888-367-1240" -match "^[0-9]{3,3}-[0-9]{3}-[0-9]{4}$"

and it now works properly.  Thank you!