I'm stuck with this error without clue or reference how to solve it:
I have this list on text.txt
Angie Apple
Angie Banana
Angie Tomato
Angie Peach
Angie Onion
I'm running substitution through ssed (super-sed version 3.62):
ssed -R 's/(?(DEFINE)(?<fruits>(Apple|Banana|Tomato|Peach)))Angie (?&fruits)/deleted/g' text.txt
but I got the following:
ssed: file regex_exc.txt line 2: pattern error.
Running the same against Perl (v5.36.0)
perl -pe 's/(?(DEFINE)(?<fruits>(Apple|Banana|Tomato|Peach)))Angie (?&fruits)/deleted/g' text.txt
I got the results correctly:
deleted
deleted
deleted
deleted
Angie Onion
My question is: Since ssed uses PCRE with the-R option, why do I get this problem? Is there a way to get it working like Perl? Running through Perl is not a option for me in this case. Thanks.
?<fruits>) and(DEFINE). Better simplify the regex to live without these, i.e.s/Angie (Apple|Banana|...)/deleted/.