Warning: preg_match() [function.preg-match] - HELP

Discussion in 'PHP' started by rajivv, Sep 17, 2011.

  1. #1
    Hi

    These are the lines of code getting errors followin is from cs-cart

    Code
    if ($partial == true) {
    $__tmp = str_replace(array('*', '?', '/'), array('.*', '.', '\/'), $v);
    if (preg_match("/^$__tmp\$/iu", $elm)) {
    $suitable = true;
    break;

    Error
    "Warning: preg_match() [function.preg-match]: Compilation failed: missing ) at offset 16 in core/fn.locations.php on line 156"

    Line 156 is if (preg_match("/^$__tmp\$/iu", $elm)) {

    Please help stuck here
     
    rajivv, Sep 17, 2011 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    change $__tmp to " . $__tmp . " maby that works :)
     
    EricBruggema, Sep 17, 2011 IP
  3. rajivv

    rajivv Peon

    Messages:
    335
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hi tried "/^".$__tmp."\$/iu" and "/^.$__tmp.\$/iu" did not work !!!

     
    rajivv, Sep 17, 2011 IP