Home: Perl Programming Help: Regular Expressions:
Post deleted by prateekm21



prateekm21
New User

Apr 22, 2009, 3:04 PM


Views: 11623
Post deleted by prateekm21

 


KevinR
Veteran


Apr 22, 2009, 3:54 PM


Views: 11618
Re: [prateekm21] Cannot print the found matched pattern

'?:' tells perl to not store the match in pattern memory. Remove '?:' from the regexp.
-------------------------------------------------


KevinR
Veteran


Apr 23, 2009, 8:49 AM


Views: 11591
Re: [KevinR] Cannot print the found matched pattern

To answer the reply you deleted.......

I am not sure if you want all the octets or only some of them. This gets all the octets regardless of how many there are in each IP:


Code
while($header =~ m/\b((\.?\d{1,3})+)\b/g){ 
print $1,"\n";
}



if you wanted to match less octets change + to {3} or whatever number of octets per IP you want to match. Your regexp might not be well written using the \b anchor because the dot in each IP is part of \b. If the IP addresses are delimited by a space in $header using \s or \s+ might be a better boundary anchor.
-------------------------------------------------


prateekm21
New User

Apr 23, 2009, 8:55 AM


Views: 11587
Re: [KevinR] Cannot print the found matched pattern

Hey kevinR thnks a ton buddy :) I solved the mystery !!! I just had some new issue , it will be great if you can help me with that


KevinR
Veteran


Apr 23, 2009, 9:15 AM


Views: 11584
Re: [prateekm21] Cannot print the found matched pattern


In Reply To
Hey kevinR thnks a ton buddy :) I solved the mystery !!! I just had some new issue , it will be great if you can help me with that


You're welcome but I see no need to delete your posts. It makes me suspicious you are cheating on something and don't want your boss/teacher to find it with a google search.
-------------------------------------------------