PHP preg_match '£'
<p>Bit surprised but the following...</p>

<pre><code>static public function VerifyAndFormatStreet(&amp;$addrStr, $mustExist)
{
    if( $addrStr !== NULL )
    {       
        $addrStr = trim($addrStr);

        // SNIP

        if( preg_match('/[^A-Za-z0-9 -.,]/', $addrStr) )
        {
            printf("\t### FAIL: BAD CHARS\n");
            throw new JEH_IllegalParameterException("Address contains illegal characters");
        }

        $addrStr = ucwords(strtolower($addrStr));
        printf("PASS STRING IS NOW $addrStr\n");
    }
    else if($mustExist)
        throw new JEH_IllegalParameterException("Address must not be empty");
}
</code></pre>

<p>The following call then fails to find an invalid character in <code>$street2</code>...</p>

<pre><code>$pass = FALSE;
try { JEH_Address::Create("12 Somestreet", "Junk£", "Frlington", "", "Portsmouth", "Hampshire", "UK", "PO1 1XX"); }
catch(JEH_IllegalParameterException $e) { $pass = TRUE; }
if( !$pass ) die("Was able to detect bad char!!!\n");
else         printf("PASS\n");
</code></pre>

<p>But if I change the <code>preg_match()</code> function to the following in the <code>Create()</code> function...
(Put the space at the end of the set)</p>

<pre><code>if( preg_match('/[^A-Za-z0-9-., ]/', $addrStr) )
</code></pre>

<p>The function works.</p>

<p>Any idea why moving the space in the character-match set works?</p>
