Robert Klemme wrote:
> The easiest (but not most efficient approach) would be to create on
> alternative for each variant you have, like
> 
> %r{
>    ^(?:
>      v(?:\.\d+)+-\d+
>    | \w+\d+-[\d_]+
>    | ...
>    )$
> }x
> 
> etc.

The problem with regular expressions is that they can easily get out of 
hand and become incomprehensible, as the above code shows (though 
presumably to RK it's totally transparent).

Better to write a number of small regexps, each testing for a specific 
pattern. Then combine the results with a logical OR. This can be done 
using a flag variable, or an if-elsif tree, a case statement, etc., 
whatever you feel happiest with. This approach will be a lot easier to 
test and debug.
-- 
Posted via http://www.ruby-forum.com/.