Thread: Should i ignore warnings on regex declaration

  1. #16
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Code:
    "[0|\+27]+[1234][123][-| ]?[0-9]{3}[-| ]?([0-9]{4})$"
    this is nor a valid c string literal.
    If your intention is to escape the + in the character class then you have to double the '\'
    e.g.
    Code:
    "[0|\\+27]+[1234][123][-| ]?[0-9]{3}[-| ]?([0-9]{4})$"
    Kurt

  2. #17
    Registered User
    Join Date
    Apr 2008
    Posts
    610
    Quote Originally Posted by ZuK View Post
    Code:
    "[0|\+27]+[1234][123][-| ]?[0-9]{3}[-| ]?([0-9]{4})$"
    this is nor a valid c string literal.
    If your intention is to escape the + in the character class then you have to double the '\'
    e.g.
    Code:
    "[0|\\+27]+[1234][123][-| ]?[0-9]{3}[-| ]?([0-9]{4})$"
    Kurt
    Thanx Kurt, does the trick

  3. #18
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Don't ignore warnings about unrecognized character escape sequences. Let it be a lesson, I guess.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  2. failure to import external C libraries in C++ project
    By nocturna_gr in forum C++ Programming
    Replies: 3
    Last Post: 12-02-2007, 03:49 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 08:13 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM