|
Posted by Robin Vickery on 08/24/05 13:44
On 8/24/05, Richard Lynch <ceo@l-i-e.com> wrote:
> On Tue, August 23, 2005 1:58 am, Robin Vickery wrote:
> > But in the mean time, it's not *that* hard to learn the syntax of
> > regular expressions. OK, they're rather terse. But apart from that,
> > they're a lot simpler than a proper language like PHP and you don't
> > seem to have problems with that.
>
> Snort!
>
> Totally different thread here...
>
> I figured out core PHP syntax in about 5 minutes, and would say I've
> mastered it over the past decade.
>
> I've been trying to figure out Regex for even longer, and still can't
> write a moderately complex Regex without building it up iteratively
> piece by piece with a lot of wailing and gnashing of teeth.
>
> The grammar and syntax of Regex (Perl or POSIX) is impenetrable, in MY
> experience.
>
> Maybe if somebody, or circumstances, forced you to learn Perl first, I
> can see how they'd seem "equally" difficult, I guess...
Yeah, well I've been programming in PHP since PHP/FI, but I did learn
Perl first. And before that I was using sed, awk and grep etc. So I
came to the language with a fair grasp of regexps.
I'd bet, if you learned the core of PHP in 5 minutes, you must have
been reasonably familiar with other procedural languages first.
Experience which you can't carry across to regular expressions.
OK, they're maybe not the most intuitive of constructs, but
structurally they're a lot more simple than a full blown programming
language.
* No loops.
* No functions.
* No recursion.
* No variable types.
* The simplest possible conditionals.
I don't believe they're *that* hard to learn, once you get beyond the
line-noise syntax.
Incidentally, with the PCRE library, you can even use the POSIX type
character classes instead of the Perl syntax if you find them easier
to understand ([[:digit:]] instead of \d, [[:word:]] instead of \w
etc).
Although I don't think that's documented in the manual.
-robin
Navigation:
[Reply to this message]
|