fantomel Posted April 17, 2010 Share Posted April 17, 2010 Hello guys, been a while since i posted around here. I`m trying to build a validation class and i was wondering what were the most often PCRE expressions that you use in your projects, and for what are they used? I`m trying to make a validation class with some predefined PCRE expressions. Quote Link to comment https://forums.phpfreaks.com/topic/198845-pcre-expressions/ Share on other sites More sharing options...
salathe Posted April 17, 2010 Share Posted April 17, 2010 There is a whole spectrum of things that I might commonly validate on. Basic things like minimum/maximum lengths (of strings, of items in a collection, etc.), character restrictions (alphanumeric, etc.) to whether a specified value (e.g. an order under) satisfies our application-specific structure, any form of user input so things like telephone numbers, credit card numbers, URLs, email addresses, date and times, and so on. Also I would bear in mind that regular expressions, while a useful tool, are not a catch-all solution. You'll probably want to use "basic" string/number/etc. functions and much more complex logic all alongside some regex, as part of the validation. Quote Link to comment https://forums.phpfreaks.com/topic/198845-pcre-expressions/#findComment-1043739 Share on other sites More sharing options...
Mchl Posted April 17, 2010 Share Posted April 17, 2010 And also remember there already are many useful functions bundled with PHP http://pl2.php.net/manual/en/book.filter.php Quote Link to comment https://forums.phpfreaks.com/topic/198845-pcre-expressions/#findComment-1043740 Share on other sites More sharing options...
fantomel Posted April 18, 2010 Author Share Posted April 18, 2010 yeah i know that filter functions are awsome there is not way you can't love them and not start using them when you have everything you need right there . And yes i think it's really hard to make this class work out the way it should be i need to consider many things, approaches, and existing functions not only regular expressions. Quote Link to comment https://forums.phpfreaks.com/topic/198845-pcre-expressions/#findComment-1044067 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.