View Single Post
  #10 (permalink)  
Old 05-22-2008, 06:52 PM
KevinADC KevinADC is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 94
Credits: 0
Rep Power: 8
KevinADC is on a distinguished road
Default Re: Regex Expressions

unless you want to modify the string there is no need to use a s/// regexp, just use m// to find the pattern and assign it to $1 or to a scalar:

Code:
$string = '<some element url = "www.gosomewhere.com" type = "some type" />';
$string =~ /"(.*?)"/;
print  $1;
Code:
$string = '<some element url = "www.gosomewhere.com" type = "some type" />';
($domain) = $string =~ /"(.*?)"/;
print  $domain;
The parenthesis are important in the above code.
Reply With Quote

Sponsored Links