This regex will tolerate the form XXX XXX XXX, XXXXXXXX or XXX-XXX-XXX. Since every part of a path is separated by a \ character, we only need to find the last one.
Note that there's just no way to check if the last portion of a path is a file or a directory just by the name alone.
Info: How to determine if a value is empty or not is a separate topic covered in the Empty Values section.
Default value from database schema could be loaded via load Default Values() method of the model. If you do not specify them, they will take the values of the attribute and the model class being validated. intval, boolval, ...) to ensure a specific type for an attribute, you can simply specify the function names of the filter without the need to wrap them in a closure: This validator checks if the input value represents a valid image file.
For comparing a date against a fixed value, you can simply use the date validator and specify its $min or $max property.
If you need to compare two dates entered in the form, e.g.
The compare validator can only be used to compare strings and numbers.
It does NOT check the remaining parts of a URL and is NOT designed to protect against XSS or any other attacks.
DOTALL is a flag in most recent regex libraries that makes the . There is no 100% reliable solution since the RFC is way too complex. ] )*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_] )*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]\.[0-9]\.[0-9]\.[0-9]))(:[0-9])? $ This will make sure that every number in the IP address is between 0 and 255, unlike the version using \d which would allow for 999.999.999.999.
metacharacter match anything INCLUDING line breaks. Java Script by default does not support this since the . This is the best solution and should work 99% of the time is. If you want to match an IP within a string, get rid of the leading ^ and trailing $ to use \b (word boundaries) instead. The regular expression is only useful to validate the format of the date as entered by a user.
Instead, it will trim the surrounding white spaces around the input value.
Note that if the input value is an array, it will be ignored by this validator.