I think he means "02" literally. Usually IP numbers aren't padded, so not
sure.
It's the range 0-255 that's problematic. Here's what I have for the range:
<option value="^(\b\d\b|\b\d\d\b|1\d\d|2[0-4]\d|25[0-5])">IP range
0-256</option>
Hmm, I guess with an IP you could add the mandatory delimiter (usually ".")
and repeat the group. But you would have to manually repeat the group at
the end where the delimiter must not be.
And then there's zero padding. Most of the IP numbers I've seen are not
zero-padded, but ...
I think the first thing I would do is see what the internet says.
A search for "regular expression ip address" immediately turns up a page
from O'Reilly, with both a simple
version and an accurate version for checking IP. As I expected, they're
able to do a repeat on the structure 3 times, but
have to do the last one by hand. They've figured out the 0 padding:
^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$
So ... no need to rebuild the wheel for most common use cases. Hmm, I
wonder about IPv6 ?
Ok, sorry for the stream-of-consciousness problem-working.
Thanks!
On Sunday, August 25, 2019 at 6:16:56 AM UTC-7, @TiddlyTweeter wrote:
>
> TonyM wrote:
>>
>> [02][0-255][0-255][0-255]
>>
>> [192][168][0-255][0-255]
>>
>
> Do you mean "02" *literally?* In regex [02] means "0" OR "2".
> The pattern can be matched I'm sure.
> But you need clarify what are "literals" & what are ranges.
>
> TT
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/77999739-c09a-4edb-858a-9c350c7070fd%40googlegroups.com.