checking for Euro currency symbol in regexp

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin

    #1

    checking for Euro currency symbol in regexp

    Hi, I want to check that a string entered via a from contains the only
    cdertain characters including the Euro currency symbol using a reg exp
    in PHP.

    I've set my web page to use charset=iso-8859-15 and tried

    $allowed = "[^-a-zA-Z0-9.:,!+£$ \\ ". chr(128) ."]";
    if ( ereg( $allowed, $str) )


    but the ereg regects any string containing the symbol.

    Any help would be great,

    Kevin
  • Andy Hassall

    #2
    Re: checking for Euro currency symbol in regexp

    On 3 Dec 2003 09:32:56 -0800, kml12001@yahoo. co.uk (Kevin) wrote:
    [color=blue]
    >Hi, I want to check that a string entered via a from contains the only
    >cdertain characters including the Euro currency symbol using a reg exp
    >in PHP.
    >
    >I've set my web page to use charset=iso-8859-15 and tried
    >
    >$allowed = "[^-a-zA-Z0-9.:,!+£$ \\ ". chr(128) ."]";
    >if ( ereg( $allowed, $str) )
    >
    >but the ereg regects any string containing the symbol.[/color]

    128 is not a valid printable character in iso-8859-15.
    The code for Euro is 164.


    It's only 128 in Microsoft Codepage 1252.


    --
    Andy Hassall (andy@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
    Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

    Comment

    Working...