Joel,

Sorry, I failed to mention that my input would also include more
ampersands "&" after the first one (ie. at the end of subsequent urls).
So rule one will always match, but it will include all of the url, the '&',
a whole bunch of crap in between, and the next url up to its '&'....!

You see the trouble?

I need to match up to "-", but only 'non-ampersand' characters:

non-ampersand: complement charset "&"

I have had success using this in little parse expressions, but sticking it
into
my main parse expression has proved to be very difficult for me.

Thanks for trying. :) Maybe today I'll figure it out.
(Yet again, a solution to a parse problem that wasn't explained fully to start
with...
dear oh dear...;-)

Anton.


[EMAIL PROTECTED] wrote:

> Hi, Anton!
>
> I think this does what you want.
>
>     >> chopurl: func [s [string!] /local part1 part2 urlchopper] [
>     [    urlchopper: [
>     [        [
>     [            copy part1 to "-" skip copy part2 to "&"
>     [            |
>     [            copy part1 to "&" (part2: copy "")
>     [            ]
>     [        to end
>     [        ]
>     [    parse/all s urlchopper
>     [    print [mold part1  mold part2]
>     [    ]
>     >> chopurl "www.somewhere.com&blah-blah"
>     "www.somewhere.com" ""
>     >> chopurl "www.somewhere.com-extrapathbit&blah-blah"
>     "www.somewhere.com" "extrapathbit"
>     >>
>
> -jn-
>
> [EMAIL PROTECTED] wrote:
> >
> > Hi,
> >
> > I want to parse some input like this:
> > "www.somewhere.com&blah-blah"    OR
> > "www.somewhere.com-extrapathbit&blah-blah".
> >
> > How can I parse up to the hyphen (if it's there) making sure it's before
> > the ampersand?
> > The ampersand tells me it's the end of the url. So I don't want to parse
> > all the way thru "blah".
> >
> > My two outputs should be, respectively:
> > "www.somewhere.com" ""    OR
> > "www.somewhere.com" "extrapathbit"
> >
> > Please help!
> >
> > Anton.

Reply via email to