Boost logo

Boost Users :

From: Michael Coles, MCDBA (admin_at_[hidden])
Date: 2006-04-03 19:45:32


Yes, it was supposed to be ^(.*)a(.*), my bad. I was typing that as I was
leaving work and not paying attention. Ah I forgot that without the
trailing question marks it's greedy. Thanks for the explanation.

-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of loufoque
Sent: Monday, April 03, 2006 6:13 PM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] Perl Regex Question

admin_at_[hidden] wrote :

> When I use this regular expression:
>
> ^(*.)a(*.)

Isn't it ^(.*)a(.*) rather ?

> Or am I getting exactly what I'm supposed to be getting here?

This is the normal behaviour.
You don't get all possibilities of how the string could be matched, you
only get one.
In your case you have two couples of parentheses, so you capture two
strings. Your "shouldn't I get 5 strings" doesn't really make sense.

> 1==>M
> 2==>nagement

This is what you get if you use (.*?) (ungreedy)

> 1==>Man
> 2==>gement

This is what you get if you use (.*) (greedy)

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net