[wellylug] Regex, replace stuff in command line help...

David Antliff david.antliff at gmail.com
Fri Jun 30 09:27:53 NZST 2006



On Fri, 30 Jun 2006, Grant McLean wrote:
> If you specify the 'g' (for global matches) option after the trailing
> slash, then the captured bits from the match are returned as an array,
> which you can then iterate through with foreach:
>
> perl -nle 'print "[$_]" foreach (/profile\?u=(.*?)"/g)' filename.html

Ah, that's cool. I figured the 'g' option would do something but I wasn't 
aware of how to get-at the results.

I wonder if Ruby does this in a similar manner?

-- 
David.




More information about the wellylug mailing list