Berkeley CSUA MOTD:Entry 49022
Berkeley CSUA MOTD
 
WIKI | FAQ | Tech FAQ
http://csua.com/feed/
2025/07/08 [General] UID:1000 Activity:popular
7/8     

2008/1/28-2/2 [Computer/SW/Unix] UID:49022 Activity:nil
1/28    Quick regex Q: Say I have a line of data, and inside that line I
        have some parts between two symbols:
        This is a line ~of data~ where ~the tildes are my symbols~
        How do I sed this line to get rid of the tildes and anything
        between each pair of tildes? The end result should be:
        This is a line where
        \_ 's/~[^~]*~//g'
           To handle the whitespace the way you request would be trickier
           and would require more knowledge of just how you're using these
           tags.
           \_ Thank you. I'll work with this for now.
           \_ I'm not sure I understand how your regex works.  Wouldn't
              's/~.*?~//g' do the job handling whitespaces as well? - ! op/pp
              \_ nvm.  Just understood what you meant about whitespaces. -pp