one more to remove spaces selectively: $string =~ s/(\s+)(?:(?!date=|time=)(?=\w+=))/*/g;
cheers, ~i On 1/20/07, Mumia W. <[EMAIL PROTECTED]> wrote:
On 01/20/2007 06:46 AM, Michael Alipio wrote: > Cool!!!! > > I got this from approximately 71% perldoc perlre: > > print "5: got $1\n" if $x =~ /^(\D*)(?=\d)(?!123)/; > > so I don't need "||" between multiple look ahead assertions... > > Sometimes, it's more rewarding to solve you're problem on your own. > You just have to RTFM.. :-) > > More power to this helpful commmunity!! > > Well if you like that, you're going to love this: use strict; use warnings; my $string = 'Jan 19 11:37:21 firewall date=2007-01-19 time=11:42:15 devname=TESTfirewall device_id=FGT-602905503304 log_id=0104032006 type=event subtype=admin pri=information vd=root user="admin" ui=GUI(192.168.1.1) action=login status=success reason=none msg="User admin login successfully from GUI(192.168.1.1)"'; my %hash = $string =~ /(\w+)=("[^"]+"|\S+)/g; s/^(")(.+)\1$/$2/ for (values %hash); local $\ = "\n"; print "log_id = $hash{log_id}"; print "msg = $hash{msg}"; print "ui = $hash{ui}"; :-) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/