Hi Ziggy
You got me wrong. Anyway thanks for example. Take a look here:
#!/usr/bin/perl @str = (); push @str, "<sm:a>\n"; push @str, "<sm:b>\n"; push @str, "BBB\n"; push @str, "</sm:b>\n"; push @str, "<sm:cs>\n"; #<----- watch this line push @str, "<sm:c no=\"1\">\n"; push @str, "CCC1\n"; push @str, "</sm:c>\n"; push @str, "<sm:c no=\"2\">\n"; push @str, "CCC2\n"; push @str, "</sm:c>\n"; push @str, "</sm:cs>\n"; #<----- and this line push @str, "</sm:a>\n"; #<----- and this line
my $i = 1; for (@str) { if ( /^(.*?)(<sm:.+?>)(.*?)$/ .. /^(.*?)(<\/sm:.+?>)/ ) { print "$_"; } $i++; }
wich returns these lines:
<sm:a> <sm:b> BBB </sm:b> <sm:cs> <----- the first watched line is present <sm:c no="1"> CCC1 </sm:c> <sm:c no="2"> CCC2 </sm:c> <----- the last two are missing from the end
What is wrong in regexp ?
Graf Laszlo
Ziggy wrote:
On Thursday 10 June 2004 16:21, Graf Laszlo wrote:
Hi Jose
Thank you for your last reply. It did work. But now I have to make some changes in my lines: By example:
<sm:a> <sm:b> BBB </sm:b> <sm:cs> <sm:c no="1"> CCC1 </sm:c> <sm:c no="2"> CCC2 </sm:c> </sm:cs> </sm:a>
As you can see, I put <sm:cs> wich means more <sm:c>s. I prefer this form // .. // of regexp. How should I change it to match all lines which contain 'sm:', no matter of following characters ?
Graf Laszlo
This is a test program I made to understand regular expressions & search and replace.
invoke it -- ./leet string
I thought about changing it to add something with null or something... but I haven't finished it eversince then.
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>