Class regex?

Simon Hobson dhcp1 at thehobsons.co.uk
Wed Aug 18 18:53:55 UTC 2010


Jason Gerfen wrote:
>Anyone why this class regex wouldn't match hardware addresses like these?
>
>match if binary-to-ascii (16,8,":",substring(hardware,0,8)) = "1:0:24:7E:09";
>
>00:24:7E:09:38:25
>00:24:7E:09:38:3D
>00:24:7E:09:37:F3

Mixing string and binary values. Hardware is only 7 bytes long for 
ethernet, and you are asking for 8 bytes !

I think you'd be better with :
match if substring(hardware,0,5) = 1:0:24:7E:09 ;

Ie, do a binary compare instead of converting to text and then 
comparing. And select a length that can actually match the value you 
provide.

-- 
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.



More information about the dhcp-users mailing list