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

前端 未结 12 2472
旧时难觅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:20

    This one specifically works for javascript's regular expression parser /[^[\]]+(?=])/g

    just run this in the console

    var regex = /[^[\]]+(?=])/g;
    var str = "This is a test string [more or less]";
    var match = regex.exec(str);
    match;
    

提交回复
热议问题