RE: [PHP-DEV] regex operators
| From: | Robert Cummings | Date: | Tue, 14 Oct 2003 18:18:15 +0000 |
| Subject: | RE: [PHP-DEV] regex operators | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-4839@lists.php.net to get a copy of this message | ||
On Tue, 2003-10-14 at 14:14, David Sklar wrote:
> On Tuesday, October 14, 2003 1:10 PM, mailto:rasmus@lerdorf.com
> wrote:
>
> > You are pushing towards
> >
> > $_~=/^\.*?\$$/;
> >
> > This is not human-readable code and one of the basic characteristics
> > that sets PHP apart from Perl.
>
> Actually, I'm pushing towards
>
> if (! ($_REQUEST['email'] =~ '/^[^@\s]+@([-a-z0-9]+\.)+[a-z]{2,}$/i')) {
> $form->addError('Please enter a valid e-mail address.');
> }
>
> There's not much we can practically do about the punctuation density of
> regular expressions, but we can make their use more widespread by changing
> the syntax of how they're invoked.
Why would this make regular expressions more widespread? I would expect
that regular expressions are used wherever necessary and otherwise not
used, regardless of syntax. Or are you saying because regex matching is
invoked via a function that you don't use regex? In such a case I'd have
to ask what you use instead!?
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com
|
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'