Should i ignore warnings on regex declaration

This is a discussion on Should i ignore warnings on regex declaration within the C++ Programming forums, part of the General Programming Boards category; 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 + ...

  1. #16
    ZuK
    ZuK is offline
    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をこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,182
    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.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

Page 2 of 2 FirstFirst 12
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, 02:49 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  4. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 07:13 PM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21