-1

(log doggies) (log needs)

^\(log (.*)[^)]\)\s*\(log (.*)[^)]\)$

It works with the exception of missing character at the end "s" as:

doggie need

choroba
  • 200,498
  • 20
  • 180
  • 248
  • Iterative coding assistance? http://stackoverflow.com/questions/32055326/how-to-capture-text-within-a-negate-class-character-using-perl http://stackoverflow.com/questions/31949142/whats-the-regular-expression-to-find-two-sets-of-parenthesis-in-a-row-using-per May I direct you to http://stackoverflow.com/q/22937618 to learn more about regex? – dlamblin Aug 17 '15 at 17:22

3 Answers3

0
^\(log (.*)\)\s*\(log (.*)\)$

You don't need to negate the ).

Takkun
  • 5,433
  • 15
  • 46
  • 68
0

The [^)] eats your s-es. Why do you need it?

my $s = '(log doggies) (log needs)';
say for $s =~ /^\(log (.*)\)\s*\(log (.*)\)$/;

Output:

doggies
needs
choroba
  • 200,498
  • 20
  • 180
  • 248
0

It looks like your .* should be [^)]*, i.e. *any number of characters that are not closing parentheses. Giving

^\(log ([^)]*)\)\s*\(log ([^)]*)\)$

Or you could fetch all instances of (log xxx) with

while ( $s =~ /\(log ([^)]*)\)/g ) {
    print $1, "\n";
}
Borodin
  • 123,915
  • 9
  • 66
  • 138