extract substring in java using regex

前端 未结 7 1633
走了就别回头了
走了就别回头了 2020-12-10 22:25

I need to extract \"URPlus1_S2_3\" from the string:

\"Last one: http://abc.imp/Basic2#URPlus1_S2_3,\" 

using regular expressi

7条回答
  •  攒了一身酷
    2020-12-10 23:05

    String s = "Last one: http://abc.imp/Basic2#URPlus1_S2_3,";
    Matcher m = Pattern.compile("(URPlus1_S2_3)").matcher(s);
    if (m.find()) System.out.println(m.group(1));
    

    You gotta learn how to specify your requirements ;)

提交回复
热议问题