-1

(log doggies) (log needs)

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

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

doggie need

choroba
  • 231,213
  • 25
  • 204
  • 289
  • 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
  • 6,131
  • 16
  • 52
  • 69
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
  • 231,213
  • 25
  • 204
  • 289
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
  • 126,100
  • 9
  • 70
  • 144