Saturday, 28 September 2013

The pattern value under Rules in Yii, why stars with "/" and ends with "/u"?

The pattern value under Rules in Yii, why stars with "/" and ends with "/u"?

I am analyzing some regex concepts basics, we all know '^' symbol used in
beginning of expression starts with some value and '$' used in the end for
expression ends with certain value and if they are used together '^exp$'
it can be matched only by exp. But in Yii while declaring rules like
For allowing only numbers we give
public function rules()
{ array('value', 'match', 'pattern' =>
'/^[0-9-]+$/u','message' => "Incorrect symbols (A-z) ."), }
I just want to know why we are using that trailing "/u" and "/" leading in
our rules. Thanks friends.

No comments:

Post a Comment