develooper Front page | perl.beginners | Postings from January 2002

Re:Regex improvment needed

Thread Next
Jorge Goncalvez
January 15, 2002 01:36
Re:Regex improvment needed
Message ID:
Hi, I have this code to parse a file and get the hardware address:
sub ParseInitDhcpdconf() {
open VIEUX,"$_Globals{DHCPDCONF}" or die "je ne peux ouvrir
$_Globals{DHCPDCONF} :$!";
	while (<VIEUX>) {

		if (/hardware ethernet /) {
			s/[^\d:A-F]//g;		# remove anything not 0..9,A..F 
or :
			print "$_\n";

	close VIEUX;
It works fine but if that comes after hardware ethernet contains a..f in 
lowercase the letter are ommitted.
How can i get rid of this behaviour.
my file looks like this:
host clin09 {hardware ethernet 00:56:9C:6B:8A:15;

but it can be for exemple
host clin09 {hardware ethernet 00:56:9c:6b:8a:15;

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About