Hey guys,

I've never been great with regular expressions, and I'm currently stuck on one that some of you may know how to fix.

I'm trying to do a match for a certain combination of pounds sterling strings.

I have some unit tests for this, and currently all but a single one are passing.

Here's the values I'm looking at:

PHP Code:

//These values should all fail:
    
public function provideNonNumericCharacters(){
        return array(
            array(
'1x'),
            array(
'100l'),
            array(
'xxx'),
            array(
'x1'),
            array(
'1x.0p'),
            array(
'1x.0p'),
            array(
'p'),
            array(
'xx.50p'),
        );
    }

  
//These values should all pass:
    
public function provideCorrectlyFormattedValues(){
        return array(
            array(
'1'),
            array(
'18'),
            array(
'10p'),
            array(
'10'),
            array(
'1p'),
            array(
'100'),
            array(
'100p'),
            array(
'1.1'),
            array(
'1.10p'),
            array(
'1.56'),
            array(
'1.56p'),
            array(
'1p')
        );
    } 
The only unit test out of all of these that is failing is for the value: 'p'. This value should be blocked, but it passes.

Here is the current expression I'm using: "/^(\p{Sc}?\d*(p{1})?)(?:\.\d{0,}p?)?$/u"

Any ideas?

Cheers!