Re: Regex and Matched Delimiters

2002-04-24 Thread Rafael Garcia-Suarez
Michael G Schwern wrote in perl.perl6.language : > On Tue, Apr 23, 2002 at 11:11:28PM -0500, Me wrote: >> Third, I was thinking that having perl 6 regexen have /s on >> by default would be easy for perl 5 coders to understand; >> not too hard to get used to; and have no negative effects >> for exi

Re: Regex and Matched Delimiters

2002-04-23 Thread Me
> when matching against something like "foo\nwiffle\nbarfoo\n" >/(foo.*)$/ # matches the last line /(foo[^\n]*)$/ # assuming perl 6 meaning of $, end of string >/(foo.*)$/m # matches the first line /(foo[^\n]*)$$/ # assuming perl 6 meaning of $$, end of line or /(foo.*?

Re: Regex and Matched Delimiters

2002-04-23 Thread Michael G Schwern
On Tue, Apr 23, 2002 at 11:11:28PM -0500, Me wrote: > Third, I was thinking that having perl 6 regexen have /s on > by default would be easy for perl 5 coders to understand; > not too hard to get used to; and have no negative effects > for existing coders beyond getting used to the change. I'm ju

Re: Regex and Matched Delimiters

2002-04-23 Thread Me
> > : I'd expect . to match newlines by default. I forgot, fourth, this simplifies the rule for . -- it would become period matches any char, period. Fifth, it makes the writing of "match anything but newline" into an explicit [^\n], which I consider a good thing. Of course, all this is minor s

Re: Regex and Matched Delimiters

2002-04-23 Thread Me
> : I'd expect . to match newlines by default. For a . that > : didn't match newlines, I'd expect to need to use [^\n]. > > But . has never matched newlines by default, not even in grep. Perhaps. But: First, I would have thought you *can't* make . match newlines in grep, period. If so, then whe

Re: Regex and Matched Delimiters

2002-04-23 Thread Aaron Sherman
On Tue, 2002-04-23 at 12:48, Larry Wall wrote: > Brent Dax writes: > : # \talso > : # \nalso or (latter matching > : logical newline) > : # \ralso > : # \falso > : # \aalso

Re: Regex and Matched Delimiters

2002-04-23 Thread Larry Wall
Brent Dax writes: : Sorry to reply to the same message twice, but I just noticed something. : : Larry Wall: : # {n,m} : : Isn't that the only use of angle brackets as a quantifier? That's going : to make parsing more difficult... How so? It's just a one-character lookahead to s

Re: Regex and Matched Delimiters

2002-04-23 Thread Larry Wall
Me writes: : > /pat/i m:i/pat/ or // or even m ??? : : Why lose the modifier-following-final-delimiter : syntax? Is this to avoid a parsing issue, or : because it's linguistically odd to have a modifier : at the end? Haven't decided for sure to lose it, but it does have several problems. Fir

RE: Regex and Matched Delimiters

2002-04-23 Thread Brent Dax
Sorry to reply to the same message twice, but I just noticed something. Larry Wall: # {n,m} Isn't that the only use of angle brackets as a quantifier? That's going to make parsing more difficult... --Brent Dax <[EMAIL PROTECTED]> @roles=map {"Parrot $_"} qw(embedding regexen C

Re: Regex and Matched Delimiters

2002-04-23 Thread Larry Wall
Aaron Sherman writes: : On Mon, 2002-04-22 at 21:53, Larry Wall wrote: : : > * Parens always capture. : > * Braces are always closures. : > * Square brackets are always character classes. : > * Angle brackets are always metasyntax (along with backslash). : > : > So a first whack

Re: Regex and Matched Delimiters

2002-04-23 Thread Larry Wall
Brent Dax writes: : # ?pat? // or even m ??? : : Whoa, those are moving to the front?!? The problem with options in general is that they can't easily modify parsing if they come in back. Now in the particular case of /f and /i, it probably doesn't matter. But I was trying

Re: Regex and Matched Delimiters

2002-04-23 Thread Aaron Sherman
On Tue, 2002-04-23 at 04:32, Ariel Scolnicov wrote: > Larry Wall <[EMAIL PROTECTED]> writes: > > [...] > > > /pat/x /pat/ > > How do I do a "no /x"? I know that commented /x'ed regexps are easier > reading (I even write them myself, I swear I do!), but having to > escape whitespac

Re: Regex and Matched Delimiters

2002-04-23 Thread Luke Palmer
On Wed, 24 Apr 2002, Iain Truskett wrote: > * Larry Wall ([EMAIL PROTECTED]) [23 Apr 2002 11:56]: > > [...] > > * Parens always capture. > > Maybe I missed something in the rest of the details, but is anything > going to replace non-capturing parens? It's just that I do find them > quite us

Re: Regex and Matched Delimiters

2002-04-23 Thread Iain Truskett
* Larry Wall ([EMAIL PROTECTED]) [23 Apr 2002 11:56]: [...] > * Parens always capture. Maybe I missed something in the rest of the details, but is anything going to replace non-capturing parens? It's just that I do find them quite useful. -- iain.

RE: Regex and Matched Delimiters

2002-04-23 Thread Luke Palmer
> # =~ $re =~ /<$re>/ ouch? > > I don't see the win. Naturally =~ $re is a bit cleaner, but we can't do that because =~ is smart match, not regex match. > # (?=...) > # (?!...) > # (?<=...) > # (? > > Cute. (Wait a minute, are

Re: Regex and Matched Delimiters

2002-04-23 Thread Aaron Sherman
On Mon, 2002-04-22 at 21:53, Larry Wall wrote: > * Parens always capture. > * Braces are always closures. > * Square brackets are always character classes. > * Angle brackets are always metasyntax (along with backslash). > > So a first whack at the differences might be: [...] >

Re: Regex and Matched Delimiters

2002-04-23 Thread Me
> /pat/i m:i/pat/ or // or even m ??? Why lose the modifier-following-final-delimiter syntax? Is this to avoid a parsing issue, or because it's linguistically odd to have a modifier at the end? > /^pat$/m /^^pat$$/ What's the mnemonic here? It feels the wrong way round -- like a single

Re: Regex and Matched Delimiters

2002-04-23 Thread Ariel Scolnicov
Larry Wall <[EMAIL PROTECTED]> writes: [...] > /pat/x/pat/ How do I do a "no /x"? I know that commented /x'ed regexps are easier reading (I even write them myself, I swear I do!), but having to escape whitespace is often very annoying. Will I really have to escape all spaces (

RE: Regex and Matched Delimiters

2002-04-23 Thread Brent Dax
Piers Cawley: # "Brent Dax" <[EMAIL PROTECTED]> writes: # > Larry Wall: # > That's...odd. Is $$ (the variable) going away? # > # > # /./s // or /<.>/ ??? # > # > I think that . is too common a metacharacter to be # relegated to this. # # I think you failed to notice that '/

Re: Regex and Matched Delimiters

2002-04-23 Thread Piers Cawley
"Brent Dax" <[EMAIL PROTECTED]> writes: > Larry Wall: > That's...odd. Is $$ (the variable) going away? > > # /./s// or /<.>/ ??? > > I think that . is too common a metacharacter to be relegated to > this. I think you failed to notice that '/s' on the regex. In general . w

Re: Regex and Matched Delimiters

2002-04-23 Thread Piers Cawley
Larry Wall <[EMAIL PROTECTED]> writes: > /^pat$/m /^^pat$$/ $$ is no longer the current PID? Or will we have to call that '${$}' in a regex? -- Piers "It is a truth universally acknowledged that a language in possession of a rich syntax must be in need of a rewrite."

RE: Regex and Matched Delimiters

2002-04-22 Thread Brent Dax
Larry Wall: # Me writes: # : > Very nice (but, I assume you meant {$foo data})! # : # : I didn't mean that (even if I should have). # : # : Aiui, Mike's final suggestion was that parens end up # : doing all the (ops data) tricks, and braces are used # : purely to do code insertions. (I really li

Re: Regex and Matched Delimiters

2002-04-22 Thread Luke Palmer
> (?=...) > (?!...) > (?<=...) > (? > (?>...) Yummy :) I'd say this is about perfect. The look(ahead|behind)s, er, look<:ahead|behind>s are used seldom enough that this is practical. And it's I much clea[nr]er than that (?=...) crap

Re: Regex and Matched Delimiters

2002-04-22 Thread Larry Wall
Me writes: : > Very nice (but, I assume you meant {$foo data})! : : I didn't mean that (even if I should have). : : Aiui, Mike's final suggestion was that parens end up : doing all the (ops data) tricks, and braces are used : purely to do code insertions. (I really liked that idea.) : : So: :

Re: Regex and Matched Delimiters

2002-04-22 Thread Aaron Sherman
On Mon, 2002-04-22 at 14:18, Me wrote: > > Very nice (but, I assume you meant {$foo data})! > > I didn't mean that (even if I should have). > > Aiui, Mike's final suggestion was that parens end up > doing all the (ops data) tricks, and braces are used > purely to do code insertions. (I really li

Re: Regex and Matched Delimiters

2002-04-22 Thread Me
> Very nice (but, I assume you meant {$foo data})! I didn't mean that (even if I should have). Aiui, Mike's final suggestion was that parens end up doing all the (ops data) tricks, and braces are used purely to do code insertions. (I really liked that idea.) So: Perl 5Perl6 (data)

Re: Regex and Matched Delimiters

2002-04-22 Thread Aaron Sherman
On Sat, 2002-04-20 at 14:33, Me wrote: > [2c. What about ( data) or (ops data) normally means non-capturing, > ($2 data) captures into $2, ($foo data) captures into $foo?] Very nice (but, I assume you meant {$foo data})! This does add another special case to the regexp parser's handling of "$",

RE: Regex and Matched Delimiters

2002-04-22 Thread Aaron Sherman
On Sat, 2002-04-20 at 05:06, Mike Lambert wrote: > > He then went on to describe something I didn't understand at all. > > Sorry. > > Few corrections to what you wrote: > > To avoid the problem of extending {} to support new features with a > character 'x', without breaking stuff that might have

Re: Regex and Matched Delimiters

2002-04-20 Thread Me
> [2c. What about ( data) or (ops data) normally means non-capturing, > ($2 data) captures into $2, ($foo data) captures into $foo?] which is cool where being explicit simplifies things, but ain't where implicit is simpler. So, maybe add an op ('$'?) or switch that makes parens capturing by d

Re: Regex and Matched Delimiters

2002-04-20 Thread Me
Let me see if I understand the final version of your (Mike's) suggestions and where it appears to be headed: Backwards compatibility: perl5 extended syntax still works in perl6 if one happens to use it. Forward conversion: Automatic conversion of relevant perl5 regex syntax to perl6 is simple.

RE: Regex and Matched Delimiters

2002-04-20 Thread Mike Lambert
> He then went on to describe something I didn't understand at all. > Sorry. Few corrections to what you wrote: To avoid the problem of extending {} to support new features with a character 'x', without breaking stuff that might have an 'x' immediately after the '{', my proposal is to require on

RE: Regex and Matched Delimiters

2002-04-19 Thread Brent Dax
Mike Lambert: (a bunch of stuff about regexes) No offense intended, but I had trouble understanding that, and I helped come up with the thing. :^) So, I'll try to interpret. In Perl 5, we came up against the problem of simply running out of characters in regexes. To deal with this, Larry came