Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • In the case cn be more simple sed -e 's#[^!]*string>!\[TEST\[\|\]>/string>[^!]*##g'? Commented Mar 7, 2015 at 20:34
  • @Costas - no. That doesn't work if there is more than one per line - or if the left-end delimiter occurs within text. Commented Mar 7, 2015 at 20:38
  • Agree. What you say re's#string>!\[TEST\[\|\]>/string>$#^#g;s/[^^]*^\([^^]*\)^[^^]*/\1 /g' If you do not sure in ^ free to change it by some more exotic. Commented Mar 7, 2015 at 20:45
  • @Costas - exotic doesn't work for unknown strings - it doesn't matter how rare it is - if it is a possibility then it is a bug. You have to sanitize it first, or use delimiters that cannot otherwise occur. Commented Mar 7, 2015 at 20:58