in reply to Help with this simple regex

This gives you the output you're looking for:
use warnings; use strict; while (my $match = <DATA>) { $match =~ /event="([^(]+).*"/; print "$1\n"; } __DATA__ <ID="user_one" event="open(2)"> <ID="user_one" event="system booted"> <ID="user_one" event="init(1m)">

Replies are listed 'Best First'.
Re^2: Help with this simple regex
by Jim (Curate) on May 28, 2013 at 20:01 UTC

    I modified your regular expression pattern slightly to avoid matching beyond the closing quote.

    use warnings; use strict; while (my $line = <DATA>) { while ($line =~ m/event="([^("]+)[^"]*"/gi) { print "$1\n"; } } __DATA__ <ID="user_one" event="open(2)"> <ID="user_one" event="system booted"> <ID="user_one" event="system booted"><ID="user_one" EVENT="init(1m)"> <ID="user_one" event="init(1m)"> <ID="" event="">