regular expression

24/02/2009 - 22:04 von amirovic | Report spam
Hi,

I have a simple question but somehow I can't solve it myself:

my $var = "[ a a a a a a a a ]";

I'm working with Parse::Recdescent and would like to match this (it's
not about Parse::Recdescent but a general question):

rule: "[" /.*/ "]"

Now "/.*/" matches everything including the "]", but I'd like to match
every before "]". How should this be done?

Thanks a lot for any response,
Tom
 

Lesen sie die antworten

#1 Ferry Bolhar
25/02/2009 - 08:49 | Warnen spam
schrieb im Newsbeitrag news:
Hi,

I have a simple question but somehow I can't solve it myself:

my $var = "[ a a a a a a a a ]";

I'm working with Parse::Recdescent and would like to match this (it's
not about Parse::Recdescent but a general question):

rule: "[" /.*/ "]"

Now "/.*/" matches everything including the "]", but I'd like to match
every before "]". How should this be done?



/[^]]*/

(Negated character class, consisting of a single ']').

BTW: this is a german-speaking NG.

Gruß aus Wien,

Ferry

Ing Ferry Bolhar
Magistrat der Stadt Wien - MA 14
A-1010 Wien
E-Mail:

Ähnliche fragen