Is there a generic way to wrap an existing regex to also accept partial matches?
For example verifying an IPV4 address one can use ((?:(?:25[0-5]|2[0-4]d|1?d{1,2})(?:.(?!$)|$)){4})
Now this works for
- 10.0.10.1
But not for
- 1
- 10
-
- 10.0
- 10.0.
- 10.0.1
- 10.0.10
- 10.0.10.
I want to provide a generic way to wrap the existing regex (or any else) without modifying it into a new regex that accepts any amount of partial ip addresses.