ADO DOT NET
Centurion
- Joined
- Dec 20, 2006
- Messages
- 160
Hi,
I want to extract all IP addresses using Regular Expressions:
-
Dim MC As MatchCollection = Regex.Matches(ReadText, "([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9])")
-
A valid IP address will be in format: xxx.xxx.xxx.xxx
Each xxx can be from 0 to 255, so it can be from 1 to 3 characters.
I think the above code should be OK.
Just there is a problem that it will accept numbers like 6.2600.5.1 which is invalid.
I know that to force it to accept only 1~3 char numbers I should use {1,3}, yes?
But I don't know where to place the {1,3}?
Please help me.
Thank you.
I want to extract all IP addresses using Regular Expressions:
-
Dim MC As MatchCollection = Regex.Matches(ReadText, "([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9])")
-
A valid IP address will be in format: xxx.xxx.xxx.xxx
Each xxx can be from 0 to 255, so it can be from 1 to 3 characters.
I think the above code should be OK.
Just there is a problem that it will accept numbers like 6.2600.5.1 which is invalid.
I know that to force it to accept only 1~3 char numbers I should use {1,3}, yes?
But I don't know where to place the {1,3}?
Please help me.
Thank you.