http://www.perlmonks.org?node_id=1008535
Kyshtynbai has asked for the wisdom of the Perl Monks concerning the following question:

Hi everyone!

I'm learning perl using "Lama Book" and now I'm in the world of regexps. There's an exercise in d foy's book of exercises, which I still can't solve :(. Here it is:

"Write a program to match a string that contains an a, but doesnt have a b anywhere after the a ".

I've written the following regexp, and is _seems_ to be proper (I've run some tests. I really does the job as far as I notice.), but in the answers section of this book there's a rather weired way to solve this exercise, which includes two "if" blocks.

Here is the regexp I've written: /\ba\b|(\b.*a[^b]+\b)/

Is it okay for this exercise, that's all I want to know :) . Thank you in advance.