www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Regular Expression problems...

reply kinghajj <kinghajj_member pathlink.com> writes:
On the Regular Expression "help" guide, it says that "\char" means to match that
"char" literally. However, when I do this, I get a warning similar to this:

undefined escape sequence \{

What do I do?
Jan 30 2005
next sibling parent "Andrew Fedoniouk" <news terrainformatica.com> writes:
 undefined escape sequence \{
 What do I do?

Try to use following sequence [{] instead. I am not sure though will it work or not in this particular implementation. Andrew Fedoniouk. http://terrainformatica.com
Jan 30 2005
prev sibling next sibling parent Chris Sauls <Chris_member pathlink.com> writes:
Out of curiousity, are your regexp's in WYSIWYG strings or escaped (aka
double-quoted) strings?  If using escaped strings, that could be the problem.

-- Chris Sauls

In article <ctk8pt$a54$1 digitaldaemon.com>, kinghajj says...
On the Regular Expression "help" guide, it says that "\char" means to match that
"char" literally. However, when I do this, I get a warning similar to this:

undefined escape sequence \{

What do I do?

Jan 30 2005
prev sibling parent Manfred Nowak <svv1999 hotmail.com> writes:
kinghajj wrote: 

[...]
 undefined escape sequence \{
 What do I do?

Seems you want to esacpe the escape character "\" by writing "\\" instead. Because first the lexical phase scans your source into tokens the character seqence " \{" is recognized as space followed by the escape sequence '\{', which has no meaning to the lexical phase. But the character sequence " \\{" is recognized as space followed by '\\' and '{' from which '\\' is recognized as valid escape sequence with the meaning '\'. Therefore the chracters " \{" are passed to the RE-programs which then can recognize the "\{" as escaped sequence. -manfred
Jan 31 2005