Re: Interesting little regex

2006-02-24 Thread Alan Young
Yes, what are the unique occurrences of text in that string? I've run the code and I'm still not exactly sure what it's supposed to do. use Data::Dump qw/ dump /; $a=abcdex4; $a=~s{((\w+?)(??{!$b{$^N}++?(?=):(?!)}))}{($1)}xg; print $a\n; print dump(\%b), \n;

Re: Interesting little regex

2006-02-24 Thread Ronald J Kimball
On Fri, Feb 24, 2006 at 01:40:15PM -0700, Alan Young wrote: Yes, what are the unique occurrences of text in that string? I've run the code and I'm still not exactly sure what it's supposed to do. use Data::Dump qw/ dump /; $a=abcdex4;

Re: Interesting little regex

2006-02-24 Thread Alan Young
I'm afraid I'm not getting what you mean by unique occurrence... Why is there only one unique occurrence of 'abc', when the string contains 'abc' four times? Why are there two unique occurrences of 'de', but only one of 'bc'? Why are there no unique occurences at all of 'abcd'? I'm

Re: Interesting little regex

2006-02-24 Thread Ronald J Kimball
On Fri, Feb 24, 2006 at 03:20:27PM -0700, Alan Young wrote: I'm afraid I'm not getting what you mean by unique occurrence... Why is there only one unique occurrence of 'abc', when the string contains 'abc' four times? Why are there two unique occurrences of 'de', but only one of 'bc'?

Re: Interesting little regex

2006-02-23 Thread Uri Guttman
AY == Alan Young [EMAIL PROTECTED] writes: AY I know, replying to myself. AY Parsing the KJV Bible took about 7 seconds with this: AY #!/usr/bin/perl -w AY use strict; AY my $text = do { AY open my $T, './kjv10.txt' or die Couldn't open kjv10.txt: $!\n; AY local $/; AY

Re: Interesting little regex

2006-02-23 Thread Jerrad Pierce
' can end words in English; the most obvious being posessive plurals, though it can also be used for some contractions as well. -- H4sICNoBwDoAA3NpZwA9jbsNwDAIRHumuC4NklvXTOD0KSJEnwU8fHz4Q8M9i3sGzkS7BBrm OkCTwsycb4S3DloZuMIYeXpLFqw5LaMhXC2ymhreVXNWMw9YGuAYdfmAbwomoPSyFJuFn2x8 Opr8bBBidcc= --

Re: Interesting little regex

2006-02-23 Thread Bart Lateur
On Thu, 23 Feb 2006 13:02:32 -0500, Uri Guttman wrote: AY $text =~ s{( AY (\b\w+(?:['-]+\w+)*\b) why the multiple ['-] inside the words? could those chars ever begin or end words? so just [\w'-]+ should be fine there. That reminds me, only earlier today I looked at the word

Re: Interesting little regex

2006-02-23 Thread Alan Young
Updated script at bottom. On 2/23/06, Uri Guttman [EMAIL PROTECTED] wrote: AY $text =~ s{( AY (\b\w+(?:['-]+\w+)*\b) why the multiple ['-] inside the words? could those chars ever begin or end words? so just [\w'-]+ should be fine there. It's possible to have

Re: Interesting little regex

2006-02-23 Thread Uri Guttman
AY == Alan Young [EMAIL PROTECTED] writes: AY Updated script at bottom. AY On 2/23/06, Uri Guttman [EMAIL PROTECTED] wrote: AY $text =~ s{( AY (\b\w+(?:['-]+\w+)*\b) why the multiple ['-] inside the words? could those chars ever begin or end words? so just [\w'-]+ should be