1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP parser misses "\" in pattern

Discussion in 'PHP' started by kamakshi, Jan 8, 2007.

  1. #1
    Hi,
    I am parsing a xml file and getting all datas.
    some datas are regular patterns, that has to be used for validation,
    Regular pattern eg:^\d{5}$
    during parsing "\" is removed and only ^d{5}$ is used for validation, wat is the problem, can anybody help out...............
    I am using this function
    xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0);
    does this function causes the problem.......
     
    kamakshi, Jan 8, 2007 IP
  2. [*-AnOnYmOuS-*]

    [*-AnOnYmOuS-*] Active Member

    Messages:
    253
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Do PHP XML parsers have regex interpreting? Never knew that... Are you sure? Because that might be the problem.
     
    [*-AnOnYmOuS-*], Jan 8, 2007 IP
  3. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Have you tried escaping the backslash?

    I.e ^\\d{5}$
     
    rodney88, Jan 8, 2007 IP
  4. kamakshi

    kamakshi Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    i tried escaping, then it was working..... anyway, i cannot do that, bcos pattern is users input, so can u tell me some other ways of overcoming this problem?
     
    kamakshi, Jan 9, 2007 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    nico_swd, Jan 9, 2007 IP
  6. brunozugay

    brunozugay Peon

    Messages:
    150
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Try using: /^d{5}$/i
     
    brunozugay, Jan 9, 2007 IP