in reply to Regular Expression Doubt
s/($NOCHANGE)|$TOCHANGE/defined $1 ? $1 : $REPLACE /ge;
If matching values for $1 cannot ever be false, this can also be written as
s/($NOCHANGE)|$TOCHANGE/$1 || $REPLACE /ge;
For your particular example, this becomes:
</code>$text =~ s<(<maths>.*?</maths>)|+>{ $1 || ' +  +' }ge;
|
|---|