Resending because I never saw the message post. Sorry if duplicate.

========================

Try this

#--------------------
my $text = "this is a website: www.hello-world.com and an e-mail: 
[EMAIL PROTECTED]";
@found = $text =~ m/\s+((?:[\w\d\-\~]{2,}[@|\.](?:[\w\d\-\~]{2,}\.?)+))/g;
print "Found something interesting:\n", join "\n", @found if @found;
#--------------------

which uses the m//g operation in a list context. Explanation from the 
perlop manpage:

The /g modifier specifies global pattern matching--that is, matching as many 
times as possible within the string. How it behaves depends on the 
context. In list context, it returns a list of the substrings matched by 
any capturing parentheses in the regular expression. If there are no 
parentheses, it returns a list of all the matched strings, as if there 
were parentheses around the whole pattern.
In scalar context, each execution of m//g finds the next match, returning true if it 
matches, and false if there is 
no further match. The position after the last match can be read or set 
using the pos() function; see pos in the perlfunc manpage. A failed match normally 
resets the search position to the beginning of 
the string, but you can avoid that by adding the /c modifier (e.g. m//gc). Modifying 
the target string also resets the search position.

Tim
_____________________________________________ 
Tim Moose |  T R I L O G Y
voice (512) 874-5342
fax (512) 874-8500 

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to