More Perl regex stuff in E

Mark S. Miller markm@erights.org
Mon, 19 Apr 1999 13:24:16 -0700


At 02:19 PM 4/16/99 , Ka-Ping Yee wrote:
>On Thu, 15 Apr 1999, Mark S. Miller wrote:
>> If I'd tried to write this without regex's, it might 
>> be locally more readable, but would also be a lot more code -- an 
>> interesting tradeoff.  How does it compare with regex use in Perl or 
>> Python?
>
>It looks pretty much par for the course, except for the cryptic
>(?ms) option in front and the unfamiliarity of the @bindings.

The (?m) flag allows multi-line input.  The (?s) flag allows newlines to be 
treated as a normal character, so that, for example, . will match it.  (?x) 
as mentioned in a previous message, allows embedded whitespace and comments. 
 If I wasn't worried about the installed base of expectations, I'd turn all 
these on by default.  I'm puzzled why anyone would want them off.


>It's surprising how much it causes E to look like Perl.  I guess
>even despite all the punctuation that Perl uses everywhere else,
>a sufficiently large fraction is in regular expressions to cause
>E-with-regexes to have a similar look.

Horrible though it may seem, given my goals, this is a good thing.
Maximize contagion!  Minimize incubation period!


>> Here's a readability test: By reading this code, can you easily tell what 
>> syntax it parses?
>
>Not in a brief glance.  I wanted to study it a little more before
>replying, but i thought i ought to point you at something i did a
>little while ago to make regular expressions more Python-like
>(i.e. readable).

How do you feel about the overly commented version?  

I didn't understand your Python example.


	Cheers,
	--MarkM