- Dec 22, 1999
- 3,385
- 0
- 0
I have a variable in Perl that is set as seen below. I want to extract <name> and make that the new value of $host. I know that I can use split to split on the . and then do it, but I want to do it with a regex without doing an "if" statement. Someone at work told me there should be a way to do it. 
The machine name is "lid" followed by 2 - 4 digits, but I used 0,5 in case of future machine naming.
$host = <name>.<domain>.<ext>
I tried to do this $host =~ s/(lid\d{0,5})/$1/g
but it doesn't change the name its still has lidXXXX.<domain>.<ext>
any ideas?
Thanks.
			
			The machine name is "lid" followed by 2 - 4 digits, but I used 0,5 in case of future machine naming.
$host = <name>.<domain>.<ext>
I tried to do this $host =~ s/(lid\d{0,5})/$1/g
but it doesn't change the name its still has lidXXXX.<domain>.<ext>
any ideas?
Thanks.
 
				
		 
			 
 
		 
 
		 
 
		 
 
		
 Facebook
Facebook Twitter
Twitter