At 11:20 AM +0200 on 6/20/99, M. Uli Kusterer wrote:

>>put item 3 (delim="/" or ":" or "\") of "hello:cruel/world\!"
>>would be 3.
>
>Anthony,
>
> "3"? Chunk expressions are for extracting data from strings. Not for
>inventing new data. Or did you mean "item 3", that is it'd return "world"?

I meant item 3, "world"

>
>>(If you want an existing example, think about what a "word" is)
>
> Well, a word is a bit more than that. With a string like:
>
> "This is  cool!"
>
>word 3 would be "cool!", whereas
>
> item 3 by " " or tab or return
>
>would be empty (there are two spaces between "is" and "cool"). You'd
>effectively have to account for *every* possible number of spaces and tabs
>to re-implement "word" with the same algorithm as items use:
>
> item 3 by " " or "  " or "   " or tab or tab & tab or tab & tab & tab or ...

Another regexp example :)

>
>>It's a lot slower.
>
> Of course! That's why I said we'd need to optimize for single-character
>delimiters. Also, it was your proposal. If you thought this was an
>argument, you hadn't proposed it, right?

Of course I don't think that's a valid argument -- it's still a lot faster
than repeated "offset"'s! And it should not slow down single-character ones.

Reply via email to