Hi all, I need to grab some URL's from a page source code and am trying to do so using regex. I am not very familiar with regex and have only used it a couple times. Here is the section of the code from which I am trying to grab the links from:
Please note I am parsing an entire page source code(9gag.com/Germany) into a string not just the code above. I would also be fine if I was just able to grab the id in each link such as "aV0qvqn" in the first one. Stack overflow suggested this solution: https://stackoverflow.com/questions/1057...l-urls-but but it does not work. This grabs every link in the source code besides the links I need so I am guessing the "\/\/" and other characters are messing it up? Help would be much appreciated on this, thanks!
Code
<script type="application/ld+json">
{"@context":"http:\/\/schema.org","@type":"ItemList","mainEntityOfPage":{"@type":"CollectionPage","@id":"https:\/\/9gag.com\/germany"},"itemListElement":[{"@type":"ListItem","position":1,"url":"https:\/\/9gag.com\/gag\/aV0qvqn\/zufalliger-diskussionsthread-sep-30-oct-6"},{"@type":"ListItem","position":2,"url":"https:\/\/9gag.com\/gag\/a3RMy45\/fang-mal-auf"},{"@type":"ListItem","position":3,"url":"https:\/\/9gag.com\/gag\/ag5Y8Nr\/vielleicht-hast-jemand-verwendung-fur-in-der-diskussionsrunde"},{"@type":"ListItem","position":4,"url":"https:\/\/9gag.com\/gag\/az1qK6z\/wie-man-jungs-dazu-bringt-in-der-schule-besser-aufzupassen"},{"@type":"ListItem","position":5,"url":"https:\/\/9gag.com\/gag\/aQ1eQY7\/wer-kennt-es-nicht"},{"@type":"ListItem","position":6,"url":"https:\/\/9gag.com\/gag\/aEgBVDM\/harry-potter-themenparks-in-deutschland"},{"@type":"ListItem","position":7,"url":"https:\/\/9gag.com\/gag\/avo7EWZ\/vier-buchstaben"},{"@type":"ListItem","position":8,"url":"https:\/\/9gag.com\/gag\/a5RnBbL\/jedes-mal"},{"@type":"ListItem","position":9,"url":"https:\/\/9gag.com\/gag\/aO0BD9y\/anruf"},{"@type":"ListItem","position":10,"url":"https:\/\/9gag.com\/gag\/aGge8ew\/ja-dann"}]} </script>Please note I am parsing an entire page source code(9gag.com/Germany) into a string not just the code above. I would also be fine if I was just able to grab the id in each link such as "aV0qvqn" in the first one. Stack overflow suggested this solution: https://stackoverflow.com/questions/1057...l-urls-but but it does not work. This grabs every link in the source code besides the links I need so I am guessing the "\/\/" and other characters are messing it up? Help would be much appreciated on this, thanks!
Need some code written or help with a programming assignment?
Check out my thread.
Check out my thread.



![[Image: LBWM9Vn.png]](https://i.imgur.com/LBWM9Vn.png)
![[Image: Syr3DlV.png]](https://i.imgur.com/Syr3DlV.png)