[plug] [Somewhat OT] Regexp guru?

Anthony J. Breeds-Taurima tony at cantech.net.au
Wed Dec 18 10:47:23 WST 2002


On Tue, 17 Dec 2002, Kirk Turner wrote:

> Heyas,
> 
> This isn't strictly a linux thing, but figured since regexp is used 
> widely in linux someone might have more of a clue
> than I do :-)

<snip>

Don't use Java so I don't know how good the re support is.  Howvere in perl

---
#!/usr/bin/perl -wT

use strict;

my $string= 'this is just a "simple little" test';
my @strings = grep {!/^$/} split(/(\".*\"|[^\s]*)\s/,$string);

print join("\n", at strings),$/;
---

should do what you want.

Yours Tony

   Jan 22-25 2003           Linux.Conf.AU            http://linux.conf.au/
		  The Australian Linux Technical Conference!



More information about the plug mailing list