Regular Expression to find a string included between two characters while EXCLUDING the delimiters

前端 未结 12 2492
旧时难觅i
旧时难觅i 2020-11-21 23:49

I need to extract from a string a set of characters which are included between two delimiters, without returning the delimiters themselves.

A simple example should b

12条回答
  •  逝去的感伤
    2020-11-22 00:25

    I had the same problem using regex with bash scripting. I used a 2-step solution using pipes with grep -o applying

     '\[(.*?)\]'  
    

    first, then

    '\b.*\b'
    

    Obviously not as efficient at the other answers, but an alternative.

提交回复
热议问题