Re: patch for string library
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: patch for string library
- From: "Asakawa, Kazuaki" <k_asakawa@...>
- Date: 2004年5月22日 00:07:51 +0900
I don't think this is a bug. I think it is expected behaviour. (At
least,
it is the behaviour I would expect.)
OK, this behavior may be selectable, but I think
the double-matching is not suitable for Lua.
Double-matching rule is not intuitively for me.
In case below, the empty string after "c" seems to be
already matched at the first match.
string.gsub("abc", ".*" "x")
And I think, it's easier to use single-matching rule
than avoiding double-matching.
Maybe I can avoid it in almost all cases, but it seems
to be complicated.
Is there any advantage for double-matching?
This behavior is not explicitly written in the reference
manual, at least I read.
If this is a selection of the Lua specification (or
the implementation), I want the author to add the
description of the behavior to the `Pattern' section.
P.S.
This is redundant, I know...
$ echo test | sed 's/.*/x/g'
x
$ echo test | awk '{gsub(".*","x");print(0ドル)}'
x
$ perl -e '$a="test";$a=~s/.*/x/g;print($a,"\n");'
xx
$ php -r 'echo ereg_replace(".*","x","test"),"\n";'
xx
--
asakawa