Thread overview
[phobos] phobos commit, revision 2259
Jan 02, 2011
dsource.org
Jan 03, 2011
spir
Jan 03, 2011
spir
Jan 03, 2011
spir
January 02, 2011
phobos commit, revision 2259


user: andrei

msg:
Deprecated std.regexp

http://www.dsource.org/projects/phobos/changeset/2259

paths changed:
U   trunk/phobos/std/regexp.d

January 03, 2011
On Sun, 2 Jan 2011 18:31:32 -0500
"dsource.org" <noreply at dsource.org> wrote:

> phobos commit, revision 2259
> 
> 
> user: andrei
> 
> msg:
> Deprecated std.regexp
> 
> http://www.dsource.org/projects/phobos/changeset/2259
> 
> paths changed:
> U   trunk/phobos/std/regexp.d

Hello Andrei,

When I checked regexp/regex recently, say ~ 10 days ago, I noticed a few useful regexp functions where not (yet) implemented in regex. Have you completed regex since then? Else maybe some people will miss it, what do you think?


Denis
-- -- -- -- -- -- --
vit esse estrany ?

spir.wikidot.com

January 02, 2011
Which ones?

Andrei

On 1/2/11 10:36 PM, spir wrote:
> On Sun, 2 Jan 2011 18:31:32 -0500
> "dsource.org"<noreply at dsource.org>  wrote:
>
>> phobos commit, revision 2259
>>
>>
>> user: andrei
>>
>> msg:
>> Deprecated std.regexp
>>
>> http://www.dsource.org/projects/phobos/changeset/2259
>>
>> paths changed:
>> U   trunk/phobos/std/regexp.d
>
> Hello Andrei,
>
> When I checked regexp/regex recently, say ~ 10 days ago, I noticed a few useful regexp functions where not (yet) implemented in regex. Have you completed regex since then? Else maybe some people will miss it, what do you think?
>
>
> Denis
> -- -- -- -- -- -- --
> vit esse estrany ?
>
> spir.wikidot.com
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
January 03, 2011
On Sun, 02 Jan 2011 23:33:45 -0600
Andrei Alexandrescu <andrei at erdani.com> wrote:

[regex / regexp]

> Which ones?

According to the doc online, at least find/rfind/search are not there. (And count is in neither module.)
By the way, maybe std.string.inPattern could be replaced by a true regex based func (also, it's currently rather slow from doing kind of hand-made match trial).

Denis
-- -- -- -- -- -- --
vit esse estrany ?

spir.wikidot.com

January 03, 2011
On 1/3/11 7:56 AM, spir wrote:
> On Sun, 02 Jan 2011 23:33:45 -0600 Andrei Alexandrescu<andrei at erdani.com>  wrote:
>
> [regex / regexp]
>
>> Which ones?
>
> According to the doc online, at least find/rfind/search are not there. (And count is in neither module.)

Let's see:

auto s = "abcabcabab";
auto result = find(s, RegExp("b"));

becomes:

auto s = "abcabcabab";
auto result = match(s, Regex("b")).pre.length;

They return different things on no match, but I think the latter is better (pre returns the whole string on failure, which makes sense and is easier to compose).

rfind has no simple equivalent so it should probably be added. On crazy thought would be to have a primitive to reverse a Regex. Then you can search the reversed string for the reversed regex.

search adds no functionality over match.

> By the way, maybe std.string.inPattern could be replaced by a true regex based func (also, it's currently rather slow from doing kind of hand-made match trial).

Yah, never liked inPattern.


Andrei
January 03, 2011
On Mon, 03 Jan 2011 09:45:28 -0600
Andrei Alexandrescu <andrei at erdani.com> wrote:

> On 1/3/11 7:56 AM, spir wrote:
> > On Sun, 02 Jan 2011 23:33:45 -0600 Andrei Alexandrescu<andrei at erdani.com>  wrote:
> >
> > [regex / regexp]
> >
> >> Which ones?
> >
> > According to the doc online, at least find/rfind/search are not there. (And count is in neither module.)
> 
> Let's see:
> 
> auto s = "abcabcabab";
> auto result = find(s, RegExp("b"));
> 
> becomes:
> 
> auto s = "abcabcabab";
> auto result = match(s, Regex("b")).pre.length;
> 
> They return different things on no match, but I think the latter is better (pre returns the whole string on failure, which makes sense and is easier to compose).

Right, hadn't explored enough to get that. (Finally used an alternative, did not need regexes anymore.)

> rfind has no simple equivalent so it should probably be added. On crazy thought would be to have a primitive to reverse a Regex. Then you can search the reversed string for the reversed regex.
> 
> search adds no functionality over match.

Agreed.

> > By the way, maybe std.string.inPattern could be replaced by a true regex based func (also, it's currently rather slow from doing kind of hand-made match trial).
> 
> Yah, never liked inPattern.

I'l have a look when I have time.

> Andrei

Denis
-- -- -- -- -- -- --
vit esse estrany ?

spir.wikidot.com