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.
$string =~s/\n<\/STRIKE>/<\/STRIKE
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You could also do it like
$string =~ s#\n(</(STRIKE|U)>)#$1\n#g ;
$string =~ s#\n(</(STRIKE|U)>)#$1\n#g
ASKER