in reply to Re: Re: Reg Expression on file name
in thread Reg Expression on file name

True, it's more readable to have an expression and the kind-of-best way is the one with two expressions. To make this quite efficient and readable, a prepost($name,$prefix,$postfix) function using substr inside would be the solution if this problem occurs more than once. This is hypothetical, it's perhaps only 30 lines of code where neither speed nor readability matter :)

About /x: I'm starting to use it nearly everywhere, i don't think it makes anything harder to read. Perl 6 regular expressions (which are then somehow comparable to Parse::RecDescent now) are /x'ed by default, getting used to this is probably helpful. Imho it makes any expression more readable, at least after you're used to it. You see this differently, because you're probably used to compact expressions because they are common in Perl 5. Try forcing yourself to make everything very optical via /x and you'll change your mind in a week.

--
http://fruiture.de
  • Comment on Re: Re: Re: Reg Expression on file name