Link to home
Start Free TrialLog in
Avatar of Randall-B
Randall-B

asked on

Combine Two String Replace RegEx into One

I have two string replace ReEx's, like:

$string =~s/\n<\/STRIKE>/<\/STRIKE>\n/g;
and
$string =~s/\n<\/U>/<\/U>\n/g;

I figure it would be more efficient to do these two replace operations in one ReEx. How can I combine them?  I tried ( | ), but that gave a 500 error.
ASKER CERTIFIED SOLUTION
Avatar of jingks03
jingks03

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Randall-B
Randall-B

ASKER

Great. That seems to work. Thanks.
Avatar of ozo
You could also do it like
$string =~ s#\n(</(STRIKE|U)>)#$1\n#g;