Steve wrote: > > If not, it would be possible to convert this (3 only, but could be > > hundreds or even thousands): > > > > /^([0-9]{1,3}\.){4}\.dsl\.dynamic\.eranet\.pl$/ > > /^([0-9]{1,3}\.){4}\.dynamic\.snap\.net\.nz$/ > > /^([0-9]{1,3}\.){4}\.nat\.umts\.dynamic\.eranet\.pl$/ > > > Are you sure the above is correct? You have there a double dot and > I think that is not correct.
Yeah, there is a mistake there. This was a paper exercise :-). > > /^([0-9]{1,3}\.){4}\.(dsl\.dynamic\.eranet\.pl|dynamic\.snap\.net\.nz|nat\.umts\.dynamic\.eranet\.pl)$/ > > > Or even shorter: > /^([0-9]{1,3}\.){4}((dsl\.dynamic|nat\.umts)\.dynamic\.eranet\.pl|dynamic\.snap\.net\.nz)$/ Agreed. > Maybe using if/endif conditions like Stan Hoeppner has done on his > pcre map could speedup things even more? -> > http://www.hardwarefreak.com/fqrdns.pcre I'm actually working with Stan already. > > and that should reject "1.1.1.1.not-found" in 1/3 the time of the > > three original regexes while also matching quicker than the original. > > > > Obviously, a conversion from the first three to the optimised version > > has to be done mechanistically to avoid errors. > > > Well... if the source is already buggy (double dot issue) then automating > that transformation is not going to help you much. True, but my plan was to automate converting a list of rDNS names like: 178.183.237.0.dsl.dynamic.eranet.pl 183.246.69.111.dynamic.snap.net.nz 188.146.109.136.nat.umts.dynamic.eranet.pl Into an optimal regex, assuming long pattern lines are accepted. Erik -- ---------------------------------------------------------------------- Erik de Castro Lopo http://www.mega-nerd.com/