in reply to RegEX Doubt

Hi,

your have been given valuable answers already, but I would suggest two possible improvements in terms of readability and ease of regex construction:

- using non-greedy quantifiers rather than negated character class for matching what is between square brackets

- creating first a sub-regex and use it then 3 times.

Possibly something like this:

$_ = "[part1-date] info - [..part2..] [..part3..] part4"; $part = qr /\[(.+?)]/; # subregex using non-greedy quantifier (sl +ightly easier than /\[([^]]+)\]/) print "$1 $2 $3" if /$part \w+ - $part $part \w+/; # prints "part1 +-date ..part2.. ..part3.."