Я хочу найти регулярное выражение для этого приложения. Я искал, но не мог найти ответ, но я не эксперт по регулярным выражениям. Я постараюсь объяснить, что я хочу сделать. Я хочу, чтобы регулярное выражение нашло все последние URL перед каждой из уникальных строк
Я пытался (?! Href). * (? <= Uniquestringcontainingspecialcharacters), но программа зависает при использовании фактического HTML, может быть, потому что это намного дольше, чем мой пример здесь. </p>
В этом примере я хочу найти все последние частичные URL-адреса перед символами Uniquest, содержащими специальные символы, которых может быть много.
Как и фиктивный материал, показанный ниже, но без новых строк (добавлены новые строки, чтобы вам было проще понять, что я имею в виду), а также randomjunk, включая пробелы и specialcharacterswithouuseusefulpatern _-., <> :; "azAZ09 на самом деле случайный материал между ссылками. Существует разное количество URL-адресов и случайный мусор между интересующими меня URL-адресами:
href="/randomtextandornumberthatIdontwant/morerandomtextandornumberthatIdontwant/" randomjunkincludingspacesandspecialcharacterswithoutausefulpatern _-.,<>:;"azAZ09
href="/randomtextandornumberthatIdontwant/morerandomtextandornumberthatIdontwant/" randomjunkincludingspacesandspecialcharacterswithoutausefulpatern _-.,<>:;"azAZ09
href="/randomtextandornumberthatIdontwant/morerandomtextandornumberthatIdontwant/" randomjunkincludingspacesandspecialcharacterswithoutausefulpatern _-.,<>:;"azAZ09
href="/randomtextandornumberthatIdontwant/morerandomtextandornumberthatIdontwant/" randomjunkincludingspacesandspecialcharacterswithoutausefulpatern _-.,<>:;"azAZ09
href="/randomtextandornumberthatIdontwant/morerandomtextandornumberthatIdontwant/" randomjunkincludingspacesandspecialcharacterswithoutausefulpatern _-.,<>:;"azAZ09
href="/theinfoIwant/moreinfoIwant/" randomjunkincludingspacesandspecialcharacterswithoutausefulpatern _-.,<>:;"azAZ09
Uniquestringcontainingspecialcharacters
randomjunkincludingspacesandspecialcharacterswithoutausefulpatern _-.,<>:;"azAZ09
href="/randomtextandornumberthatIdontwant/morerandomtextandornumberthatIdontwant/" randomjunkincludingspacesandspecialcharacterswithoutausefulpatern _-.,<>:;"azAZ09
href="/randomtextandornumberthatIdontwant/morerandomtextandornumberthatIdontwant/" randomjunkincludingspacesandspecialcharacterswithoutausefulpatern _-.,<>:;"azAZ09
href="/randomtextandornumberthatIdontwant/morerandomtextandornumberthatIdontwant/" randomjunkincludingspacesandspecialcharacterswithoutausefulpatern _-.,<>:;"azAZ09
href="/differentinfoIwant/moredifferentinfoIwant/" randomjunkincludingspacesandspecialcharacterswithoutausefulpatern _-.,<>:;"azAZ09
Uniquestringcontainingspecialcharacters
randomjunkincludingspacesandspecialcharacterswithoutausefulpatern _-.,<>:;"azAZ09
Так вот, я хочу получить:
/theinfoIwant/moreinfoIwant/
/differentinfoIwant/moredifferentinfoIwant/