Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2008-02-22 04:15:55


David Ward wrote:
> Boosters:
>
>
>
> I'm having trouble determining a regular expression that will do the
> following:
>
>
>
> 1. Match the following strings:
> TermGeMstreamIPTriplePlay_11.0.IpTxMstream_0.DefaultGateway
> TermGeMstreamIPTriplePlay_11.0.VplsTxMstream_0.CurMbps
> TermGeMstreamIPTriplePlay_11.0.MplsTxMstream_0.AvgMbps
> TermGeMstreamIPTriplePlay_11.0.MacTxMstream_0.Address
>
>
>
> 2. But not match the string:
> TermGeMstreamIPTriplePlay_11.0.TrafficTxMstream_0.RampStart
>
>
>
> So, essentially match the strings with IpTx, VplsTx, MplsTx and MacTx,
> but not match strings with TrafficTx.
>
>
>
> Right now, I have:
>
>
>
> .*\.(IpTx|MacTx|MplsTx|VplsTx)Mstream_0\..*
>
>
>
> This works, however, it is not very robust because there may be more
> entries added to the matching words over time.
>
>
>
> Is there someway to do an anti-match on the word "TrafficTx"?
> Something
> like:
>
>
>
> .*\.(!TrafficTx)Mstream_0\..*

Use a zero width lookahead assertion, so something like:

.*\.(?!TrafficTx)\w+Mstream_0\..*

HTH, John.


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