Regular Expression Reference required!!

Check this awesome online web 2.0 application for regular expressions: http://www.regexplanet.com

In particular I am testing this regex: [0-9]{1,7}(\.[0-9]{1,2})*

It is a bank format number, and works great

I have tried inside the model rules each of these (unsuccessfully)

‘pattern’ => ‘/[0-9]{1,7}(\\.[0-9]{1,2})*$/’

‘pattern’ => ‘[0-9]{1,7}(\\.[0-9]{1,2})*$’

‘pattern’ => ‘/[0-9]{1,7}(\\.[0-9]{1,2})*/’

‘pattern’ => ‘[0-9]{1,7}(\\.[0-9]{1,2})*’

‘pattern’ => ‘/[0-9]{1,7}(\.[0-9]{1,2})*$/’

‘pattern’ => ‘/[0-9]{1,7}(\.[0-9]{1,2})*/’

‘pattern’ => ‘[0-9]{1,7}(\.[0-9]{1,2})*’

The bottom line is that a reference for regular expressions in Yii is needed yesterday.

Is there a cheatsheet or something like that for regular expressions?

And finally do you have the answer for the specific regular expression

I am at the point where 123.123 is valid, which it shouldn’t !

Thank everyone, and also thanks for the feedback on my previous topics. I’ll try to seed back :)

[font="arial, verdana, tahoma, sans-serif"][size="2"]Try removing the * from the end to match nothing more but the regexp. Or if you need more characters after the regexp append a whitespace …[/size][/font]

[font="arial, verdana, tahoma, sans-serif"] [/font]

[font=“arial, verdana, tahoma, sans-serif”] [/font][font=“arial, verdana, tahoma, sans-serif”][size=“2”]Other than that i don’t see any “magic” about Yii specific regexps, it’s just a regural regexp pattern which needs to be submitted to the ‘pattern’.[/size][/font]

Yii uses PHP’s PCRE wich have quite extensive documentation. There’s no need to duplicate this documentation:

http://de3.php.net/manual/en/reference.pcre.pattern.syntax.php

Mike thanks for the reply I was just confused with the whole "/" prefix and "/" postfix. Also I used to work in another regex where the "$" symbol was not a special character.

Anyways thanks once more