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:
values between quotes

 



ym_chaitu
Novice

Jun 4, 2010, 4:56 AM

Post #1 of 3 (3084 views)
values between quotes Can't Post

i have a string like this

Quote
<ComposedBlock ID="ZONE1-2" STYLEREFS="PAR1" HEIGHT="1062" WIDTH="1986" HPOS="573" VPOS="3003">




i need to get the values between the " " after the ID= . So how can i do it, Can any one help me??


Bianca
User

Jun 4, 2010, 6:35 AM

Post #2 of 3 (3081 views)
Re: [ym_chaitu] values between quotes [In reply to] Can't Post

perhaps

Code
#!/usr/bin/env perl 
use strict;
use warnings;
my $string ='<ComposedBlock ID="ZONE1-2" STYLEREFS="PAR1" HEIGHT="1062" WIDTH="1986" HPOS="573" VPOS="3003">';
if ($string =~ /id="([^"]+)"/i) {
print $1;
}



ym_chaitu
Novice

Jun 4, 2010, 7:04 AM

Post #3 of 3 (3078 views)
Re: [Bianca] values between quotes [In reply to] Can't Post

thank you binaca

i found out the answer..This is the code..

Code
use strict; 
use warnings;

my $string = '<ComposedBlock ID="ZONE1-2" STYLEREFS="PAR1" HEIGHT="1062" WIDTH="1986" HPOS="573" VPOS="3003">';

my ($id) = $string =~ /ID="(.*?)"/;

print $id;

Wink

 
 


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

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