Results 1 to 4 of 4
  1. #1

    Exclamation [function.preg-match]: Delimiter must not be alphanumeric or backslash

    Hello,

    I have this code

    PHP Code:
            if (!preg_match('utf',strtolower($script_encoding)) && !defined('IN_LOGINPAGE'))
                                        {
                                            
    mysql_query("SET NAMES 'utf8'");
                                        }
                                        else if (empty(
    $script_encoding) || preg_match('utf',strtolower($script_encoding))) 
    and I get this error

    Warning: preg_match() [function.preg-match]: Delimiter must not be alphanumeric or backslash in /home/xxx/public_html/includes/mysql.php on line 62

    How can I fix it ?

  2. #2
    Join Date
    Aug 2002
    Location
    Milton Keynes
    Posts
    352
    Because 'utf' isn't a valid PCRE.


    Use the following instead:

    /^UTF/

  3. #3
    I got this error

    Parse error: syntax error, unexpected '/', expecting ')' in /home/massy/public_html/includes/mysql.php on line 62

  4. #4
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    5,842
    You still need quotes around the pcre, as well as the slash delimiters.
    Code:
    preg_match('/utf/',strtolower($script_encoding))
    Chris

    "Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter

Similar Threads

  1. Using a non-alphanumeric character in FTP password: HOW!?!
    By NICguy in forum Hosting Security and Technology
    Replies: 1
    Last Post: 11-10-2006, 10:45 PM
  2. Javascript: match backslash
    By Antartican in forum Programming Discussion
    Replies: 1
    Last Post: 01-31-2006, 11:27 PM
  3. Unknown modifier - preg match error
    By michael-lane in forum Programming Discussion
    Replies: 7
    Last Post: 09-15-2005, 06:48 PM
  4. Checking if strings contain only alphanumeric characters plus space
    By overulem in forum Programming Discussion
    Replies: 6
    Last Post: 06-28-2005, 05:34 PM
  5. where's the location of your backslash key?
    By priyadi in forum Web Hosting Lounge
    Replies: 26
    Last Post: 03-04-2002, 05:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •