CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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

 



prateekm21
New User

Apr 22, 2009, 3:04 PM

Post #1 of 5 (4676 views)
Post deleted by prateekm21

 


KevinR
Veteran


Apr 22, 2009, 3:54 PM

Post #2 of 5 (4671 views)
Re: [prateekm21] Cannot print the found matched pattern [In reply to] Can't Post

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


KevinR
Veteran


Apr 23, 2009, 8:49 AM

Post #3 of 5 (4644 views)
Re: [KevinR] Cannot print the found matched pattern [In reply to] Can't Post

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

Post #4 of 5 (4640 views)
Re: [KevinR] Cannot print the found matched pattern [In reply to] Can't Post

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

Post #5 of 5 (4637 views)
Re: [prateekm21] Cannot print the found matched pattern [In reply to] Can't Post


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.
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives