Issues with std.regex

MrAppleseed email at email.com
Sat Feb 16 13:36:14 PST 2013


On Saturday, 16 February 2013 at 20:33:15 UTC, FG wrote:
> On 2013-02-16 21:22, MrAppleseed wrote:
>> auto reg = regex("[ 0-9a-zA-Z.*=+-;()\"\'\[\]<>,{}^#/\\]");
>>
>> When I try to run the code above, I get:
>> parser.d(64): Error: undefined escape sequence \[
>> parser.d(64): Error: undefined escape sequence \]
>>
>> When I remove the escaped characters (turning my regex into
>> "[ 0-9a-zA-Z.*=+-;()\"\'[]<>,{}^#/\\]"), I get no issues 
>> compiling or linking.
>> However, on first run, I get the following error (I cut the 
>> error short, full
>> error is pasted http://pastebin.com/vjMhkx4N):
>>
>> std.regex.RegexException@/usr/include/dmd/phobos/std/regex.d(1942): 
>> wrong
>> CodepointSet
>> Pattern with error: `[ 0-9a-zA-Z.*=+-;()"'[]` <--HERE-- 
>> `<>,{}^#/\]`
>>
>
> Perhaps try this:  "[ 0-9a-zA-Z.*=+-;()\"\'\\[\\]<>,{}^#/\\]"

Hey,

Thanks for the reply! You guys are quite the friendly people. :)

I made the changes you suggested above, and although it compiled 
fine, on the first run I got a similar error:

std.regex.RegexException@/usr/include/dmd/phobos/std/regex.d(1942): 
unexpected end of CodepointSet
Pattern with error: `[ 0-9a-zA-Z.*=+-;()"'\[\]<>,{}^#/\]` 
<--HERE-- ``

(Full error is here: http://pastebin.com/rTmHuVjG)



More information about the Digitalmars-d-learn mailing list