Call me crazy!

s/(&|?)pg=[^&]*/\1/

(correct escaping of & and ? left as an exercise for someone actually using
this :)

On 27 July 2010 08:03, Martin Barry <[email protected]> wrote:

> Sorry to bring up an old thread but I just had to comment on this...
>
> $quoted_author = "Jamie Wilkinson" ;
> >
> > Try:
> >
> > /&pg=[^&]*/
> >
> > match zero or more of the character class that is not an ampersand.
>
> Except there is nothing stopping the variables being reordered, no? So you
> may need to match a leading ? instead of &.
>
> You could get crazy and try to do this in a single regex but two stage is
> clearer. e.g.
>
> sed -e 's/&pg=[^&]*//g' -e 's/?pg=[^&]*&/?/'
>
>
> cheers
> Marty
> --
> SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
>
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to