How to extract a substring using regex

前端 未结 14 1479
暖寄归人
暖寄归人 2020-11-22 13:37

I have a string that has two single quotes in it, the \' character. In between the single quotes is the data I want.

How can I write a regex to extract

14条回答
  •  庸人自扰
    2020-11-22 14:29

    You don't need regex for this.

    Add apache commons lang to your project (http://commons.apache.org/proper/commons-lang/), then use:

    String dataYouWant = StringUtils.substringBetween(mydata, "'");
    

提交回复
热议问题