Hi, I have a list of different text patterns and I'm only interested in a certain part of their content, which is different for each pattern. The main constraint is doing this within a substitution statement.
$split_regex has 4 different expressions with one buffer each. Each input string contains one or more patterns. Thus I have to seperate the output string to be able to see their boundaries. My main itch are the additional whitespaces I'd have if one of the buffers is empty: $subst =~ s/(?:(?:$first_regex|$second_regex|$third_regex|$fourth_regex)[\/\s]?)+/\1 \2 \3 \4/; Because of this, I resorted to the following solution, which I deem not particularly elegant, but which prints no unnecessary whitespace: $subst =~ s/(?:(?:$first_regex|$second_regex|$third_regex|$fourth_regex)[\/\s]?)+/($1?$1." ":"").($2?$2." ":"").($3?$3." ":"").($4?$4." ":"")/e; Does anybody have an idea/hint/suggestion how to accomplish this without using the /e modifier, ie. with regex syntax only? Thanks in advance, Markus -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/