Re: hotplug regexes, other misc regex questions

2002-09-23 Thread Andrew Pimlott
On Wed, Sep 18, 2002 at 05:01:35PM +0200, Damian Conway wrote: > Steve Fink wrote: > > print "yes" if "helo" =~ /hel { .pos-- } lo/; > > This definitely has to work. But remember the call to C is on > the "match object" (i.e. $0), not the string. > > Actually, I would expect that *any* pattern

Re: hotplug regexes, other misc regex questions

2002-09-21 Thread Steve Fink
On Wed, Sep 18, 2002 at 05:01:35PM +0200, Damian Conway wrote: > Steve Fink wrote: > > >What possible outputs are legal for this: > > > > "aaa" =~ /( a { print 1 } | a { print 2 })* { print "\n" } x/ > > Unless Larry specifies a required semantics, there are potentially very > many acceptable o

Re: hotplug regexes, other misc regex questions

2002-09-21 Thread Steve Fink
On Mon, Sep 16, 2002 at 10:32:17AM +0300, Markus Laire wrote: > On 15 Sep 2002 at 22:41, Steve Fink wrote: > > Your code seems to backtrack to the beginning at every failure. First > code only backtracks one char at time. > > Huh? What implementation is that? I think my naive implementation > >

Re: hotplug regexes, other misc regex questions

2002-09-20 Thread Larry Wall
On Fri, 20 Sep 2002, Sean O'Rourke wrote: : On Fri, 20 Sep 2002, Larry Wall wrote: : > But if a fast implementation needs to keep pointers into a string : > rather than offsets from the beginning, we're asking for core dumps if : > the string is modified out from under the pointers, or we have to

Re: hotplug regexes, other misc regex questions

2002-09-20 Thread Sean O'Rourke
On Fri, 20 Sep 2002, Larry Wall wrote: > But if a fast implementation needs to keep pointers into a string > rather than offsets from the beginning, we're asking for core dumps if > the string is modified out from under the pointers, or we have to > adjust all known pointers any time the string ma

Re: hotplug regexes, other misc regex questions

2002-09-20 Thread Larry Wall
On Sun, 15 Sep 2002, Steve Fink wrote: : What should this do: : : my $x = "the letter x"; : print "yes" if $x =~ /the { $x .= "!" } .* !/; Depends. I think it may be necessary for speed and safety reasons to set COW on the string we're matching, so that you're always matching against the or

Re: hotplug regexes, other misc regex questions

2002-09-19 Thread Josh Jore
On Wed, 18 Sep 2002, Luke Palmer wrote: > On Wed, 18 Sep 2002, Josh Jore wrote: > > On Wed, 18 Sep 2002, Damian Conway wrote: > > > > What possible outputs are legal for this: > > > > > > > > "aaa" =~ /( a { print 1 } | a { print 2 })* { print "\n" } x/ > > > > I take it that what I've learned f

Re: hotplug regexes, other misc regex questions

2002-09-19 Thread Damian Conway
Josh Jore wrote: >>>Would it be correct for this to print 0? Would it be correct for this >>>to print 2? >>> >>> my $n = 0; >>> "aargh" =~ /a* { $n++ } aargh/; >>> print $n; >> >>Yes. ;-) > > Wouldn't that print 2 if $n is lexical Err. It *is* lexical in this example. > and 0 if it's local

Re: hotplug regexes, other misc regex questions

2002-09-18 Thread Luke Palmer
On Wed, 18 Sep 2002, Josh Jore wrote: > On Wed, 18 Sep 2002, Damian Conway wrote: > > > > Would it be correct for this to print 0? Would it be correct for this > > > to print 2? > > > > > > my $n = 0; > > > "aargh" =~ /a* { $n++ } aargh/; > > > print $n; > > > > Yes. ;-) > > Wouldn't that

Re: hotplug regexes, other misc regex questions

2002-09-18 Thread Josh Jore
On Wed, 18 Sep 2002, Damian Conway wrote: > > Would it be correct for this to print 0? Would it be correct for this > > to print 2? > > > > my $n = 0; > > "aargh" =~ /a* { $n++ } aargh/; > > print $n; > > Yes. ;-) Wouldn't that print 2 if $n is lexical and 0 if it's localized? Or are lexic

Re: hotplug regexes, other misc regex questions

2002-09-18 Thread Damian Conway
Steve Fink wrote: > What should this do: > > my $x = "the letter x"; > print "yes" if $x =~ /the { $x .= "!" } .* !/; > > Does this print "yes"? If it's allowed at all, I think the match should succeed. > print "yes" if "helo" =~ /hel { .pos-- } lo/; This definitely has to work. But r