SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Very strange regex problem

    I have the following PHP line holding a regex:

    PHP Code:
    preg_replace("/[^\p{L}\p{N}\p{Pc}@]/u"""$str); 
    This code is set to allow unicode and the @ sign.

    It works on my localhost development system running windows vista and php 5.2.4.

    I then, after finishing my code, copied it to my linux server running php 5.2.6... and now that regex no longer works. It simply returns an empty string even with simple alphanumeric code.

    I hope someone here has an idea as to why this works on windows and why it does not work on my linux system. This is very frustrating to find out it no longer works, after so many days of hard work.

  2. #2
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've been digging around a bit and PCRE is enabled. Maybe UTF8 support is not enabled inside PCRE?

    PHP was compiled "-with-pcre-regex=/usr'".

    I couldnt find a new PCRE for my Fedora 5 so i just compiled a new one (with UTF8). But i guess i have 2 PCRE's installed now. Now i have no idea how to link PHP to this new PCRE.

    Maybe there is someone out there who knows how to fix this?

  3. #3
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,147
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    From http://www.pcre.org/pcre.txt
    If PCRE is built with Unicode character property support (which implies
    UTF-8 support), the escape sequences \p{..}, \P{..}, and \X are sup-
    ported.
    So it needs to be compiled with both UTF-8 and Unicode support.

  4. #4
    SitePoint Member
    Join Date
    Oct 2005
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did compile a new one.. but it seems i now have 2 PCRE's installed, which partially wrote over the old one. I couldnt find the source for my old version on the system.

    I'm basically clueless now. I installed the binaries in the old path, but when i check phpinfo, it still shows the old PCRE version. I've got no clue as to how i can get PHP to see this new version.


Bookmarks

Posting Permissions

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