Это URL:
https://www.pinterest.com/pin/700943129 ... ssfo=1/1/п Хочу извлечь:
https://www.pinterest.com/pin/700943129497635499
Мой код:
Код: Выделить всё
url="https://www.pinterest.com/pin/700943129497635499/sent/?invite_code=ba8f1ef48e1747199003308cdc92bbb9&sender=773000860950082435&sfo=1";
final Pattern pattern = Pattern.compile("https://www\\.pinterest\\.com/pin/.*/", Pattern.DOTALL);
final Matcher matcher = pattern.matcher(url);
url = matcher.group(1);
System.out.println(url);
Подробнее здесь: https://stackoverflow.com/questions/664 ... rn-in-java