Search code examples
preg-matchpropel

Cant do work Propel Match validators


Im developing a CRUD application. I use Propel as ORM, and added validate rules into the schema.xml. But this, not work fine. For example, i send a string that contains a user lastname, and the validator is:

<rule name='minLength' value='4'/>
<rule name='maxLength' value='30'/>
<rule name='notMatch' value='/^\s+$/' />
<!-- the name can be only chars and spaces -->
<rule name='match' value='/[^A-Za-z ]$/'/>

The user lastname sent was: 'Martinez D Elia'. And the valid fails on 4th rule. Any idea ?.


Solution

  • The regex is wrong. The correct match is:

    ^[A-Za-z ]*$