Re: wildcat pattern matching

2003-07-13 Thread Bryan Harris
>> $tmp =~ /.*?<\/artist>/; >> $artist = substr($tmp,$-[0]+8,$+[0]-$-[0]-9); > > How on EARTH did you learn about the @- and @+ arrays, WITHOUT learning > about the $1, $2, $3, etc. variables? Honestly, which regex tutorial have > you been using? What are @- and @+? I've never heard of those..

Re: wildcat pattern matching

2003-07-13 Thread Jeff 'japhy' Pinyan
On Jul 12, Ling F. Zhang said: >I am doing an xml parser to manage my list of >mp3s...say after reading my xml file, my variable >reads: >$tmp = 'artist#1 >songtitle...' It might be wiser to use a real XML parser (written in Perl, of course) instead of writing your own regexes to deal with your i

Re: wildcat pattern matching

2003-07-13 Thread Michele Marcionelli
> $tmp = 'artist#1 > songtitle...' If you define this function: sub get_container { local ($name, $src) = @_; $src =~ m/<$name>(.*?)<\/$name>/i; return $1; } Then you can use it as follow: $artist = get_container('artist', $tmp); $artist = get_container('title', $tmp); .

Re: wildcat pattern matching

2003-07-13 Thread Michele Marcionelli
Hello Ling, > I am doing an xml parser to manage my list of > mp3s...say after reading my xml file, my variable > reads: > $tmp = 'artist#1 > songtitle...' > > anyway, you get the idea...now, I want to extract the > artist...so I do: > > $tmp =~ /.*?<\/artist>/; > $artist = substr($tmp,$-[0]+8,$

Re: wildcat pattern matching

2003-07-12 Thread Bryan Harris
> $tmp =~ /.*?<\/artist>/; > $artist = substr($tmp,$-[0]+8,$+[0]-$-[0]-9); Have you tried this? $tmp =~ /(.*)<\/artist>/; $artist = $1; - B -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

wildcat pattern matching

2003-07-12 Thread Ling F. Zhang
I am doing an xml parser to manage my list of mp3s...say after reading my xml file, my variable reads: $tmp = 'artist#1 songtitle...' anyway, you get the idea...now, I want to extract the artist...so I do: $tmp =~ /.*?<\/artist>/; $artist = substr($tmp,$-[0]+8,$+[0]-$-[0]-9); where, 8 and 9 is t