DMD 0.148 - regular expressions

Derek Parnell derek at psych.ward
Sun Feb 26 11:19:35 PST 2006


On Mon, 27 Feb 2006 04:58:21 +1100, Walter Bright  
<newshound at digitalmars.com> wrote:

>
> "Lars Ivar Igesund" <larsivar at igesund.net> wrote in message
> news:dts47r$14c0$1 at digitaldaemon.com...
>> I liked the idea (match expressions), just not the operator, and I  
>> thought
>> that was a common opinion...
>
> if ("regex" ~~ "string")
>     _match. ...
>
> The equivalent functionality can now be done with:
>
> if (m; search("string", "regex"))
>     m. ...

I don't think that is quite correct. This program failed to compile ....

   void main()
   {
     if (m; search("string", "regex")) {}
   }


I got the messages ...
   test2.d(3): undefined identifier search
   test2.d(3): function expected before (), not search of type int

It turns out that "import std.regexp;" is now required.

-- 
Derek Parnell
Melbourne, Australia



More information about the Digitalmars-d mailing list