Re: Trouble with m///g

2004-09-30 Thread Chap Harrison
On Sep 30, 2004, at 10:41 AM, Jan Eden wrote: my @a = ($foo =~ m'(? Careful, you mistyped the original proposition: my @a = ($foo =~ m'(? Oops, sorry - I copied that into the email from Wiggins' reply, but actually tested with Dave Gray's. Didn't notice the difference. What you posted gives the

Re: Trouble with m///g

2004-09-30 Thread Jan Eden
Chap Harrison wrote on 30.09.2004: > >On Sep 30, 2004, at 9:55 AM, Wiggins d Anconia wrote: > >> Out of curiousity based on your description shouldn't it return, >> >> ::::::: >> >> Or do you really mean, you are trying to capture all 4 digit strings >> that are not

Re: Trouble with m///g

2004-09-30 Thread Dave Gray
> TIMTOWTDI: > > @list = grep length==4, /\d+/g Shouldn't that be: @list = grep length==4, $foo =~ /\d+/g; Cool solution, I wouldn't have thought to do it that way. I'm getting varying Benchmarking results, though. I think it might have something to do with grep speedups from 5.6.1 to 5.8.0.

Re: Trouble with m///g

2004-09-30 Thread Chap Harrison
On Sep 30, 2004, at 9:55 AM, Wiggins d Anconia wrote: Out of curiousity based on your description shouldn't it return, ::::::: Or do you really mean, you are trying to capture all 4 digit strings that are not in a string of longer digits? You need to be very explic

Re: Trouble with m///g

2004-09-30 Thread Gunnar Hjalmarsson
Chap Harrison wrote: I'm trying to extract all four-digit numbers from a string in one fell swoop, but I can't seem to come up with the proper regexp. This is my first time using /g in a match so maybe there's a trick I'm missing. For example, the string " aa 444 -

RE: Trouble with m///g

2004-09-30 Thread Bob Showalter
Chap Harrison wrote: > Hi, > > I'm trying to extract all four-digit numbers from a string in one fell > swoop, but I can't seem to come up with the proper regexp. This is my > first time using /g in a match so maybe there's a trick I'm missing. > > For example, the string > > " aa 4

Re: Trouble with m///g

2004-09-30 Thread Chap Harrison
Hmmm... m'\b(\d{4})\b'g < aa 444 -> ::: Doesn't give me or . I think the problem has to do with where m///g starts on subsequent iterations. The pattern specifies a delimiter for both the start and the end of the target substring, but

RE: Trouble with m///g

2004-09-30 Thread Wiggins d Anconia
Please bottom post... > I think this might work. > It might, but doesn't. Some testing would be good before posting inaccurate responses. > /\b\d{4}\b/ > \b is matching on boundaries, so you miss the first set, and the set with the 'aa' around them, and then there is the set with the '-'

Re: Trouble with m///g

2004-09-30 Thread Dave Gray
> For example, the string > > " aa 444 -" > > should yield > > , , , , , . That's actually kind of tricky. How about: $aa = " aa 444 -"; @aa = $aa =~ /(?http://learn.perl.org/>

RE: Trouble with m///g

2004-09-30 Thread Hanson, Rob
I think this might work. /\b\d{4}\b/ Rob -Original Message- From: Chap Harrison [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 10:38 AM To: [EMAIL PROTECTED] Subject: Trouble with m///g Hi, I'm trying to extract all four-digit numbers from a string in one fell swoop, bu