[phobos] std.regex

Andrei Alexandrescu via phobos phobos at puremagic.com
Tue May 31 09:59:07 PDT 2016


No idea, I just pasted your code in https://dpaste.dzfl.pl/cb18d29d187c 
and it works fine with dmd and ldc.

A few simple things you could try at this point:

* Search the stdlib source code for matchAll. You should find it.

* Try to qualify the name: std.regex.matchAll.

* Review your command line. It mentions "re.d" twice which is suspicious.


Andrei

On 05/29/2016 01:59 PM, Chris Moller via phobos wrote:
> Starting with the usual turn-off disclaimer, "I'm new to D..." Sorry,
> but I'm in hair-tearing mode.
>
> I'm trying to compile part of the sample code from
> dlang.org/phobos/std_regex.html:
>
> import std.regex;
> import std.stdio;
>
> void main()
> {
>    // Print out all possible dd/mm/yy(yy) dates found in user input.
>    auto r =
> regex(r"\b[0-9][0-9]?/[0-9][0-9]?/[0-9][0-9](?:[0-9][0-9])?\b");
>    foreach(line; stdin.byLine)
>    {
>      // matchAll() returns a range that can be iterated
>      // to get all subsequent matches.
>      foreach(c; matchAll(line, r))
>        writeln(c.hit);
>     }
> }
>
> What I'm getting is:
>
> [0] (moller at qcore) >ldc2 -c re.d re.d
> (13): Error: undefined identifier matchAll
>
> [1] (moller at qcore) >ldc2 --version
> LDC - the LLVM D compiler (0.12.0):
>    based on DMD v2.063.2 and LLVM 3.3
>    Default target: x86_64-redhat-linux-gnu
>    Host CPU: core2
> http://dlang.org - http://wiki.dlang.org/LDC
>    Registered Targets:
>      aarch64 - AArch64
>      arm - ARM
>      cpp - C++ backend
>      nvptx - NVIDIA PTX 32-bit
>      nvptx64 - NVIDIA PTX 64-bit
>      ppc32 - PowerPC 32
>      ppc64 - PowerPC 64
>      r600 - AMD GPUs HD2XXX-HD6XXX
>      systemz - SystemZ
>      thumb - Thumb
>      x86 - 32-bit X86: Pentium-Pro and above
>      x86-64 - 64-bit X86: EM64T and AMD64
>
> [0] (moller at qcore) >uname -a
> Linux qcore.mollernet.net 3.14.4-200.fc20.x86_64 #1 SMP Tue May 13
> 13:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
>
>  From /etc/dmd.conf:
> DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import
> -L-L/usr/lib64 -L--export-dynamic
>
>
> So, what am I doing wrong?
>
> Thanks,
> Chris Moller
>
>
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>


More information about the phobos mailing list