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
> 
> "1111 2222aa3333 444 55555555 6666 7777-8888"
> 
> should yield
> 
> 1111, 2222, 3333, 6666, 7777, 8888.

TIMTOWTDI:

  @list = grep length==4, /\d+/g

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to