Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Extracting string between angle brackets <, > in Perl

I’m making an api call that returns some data but also requires me to use some pagination in order to grab ALL of the data. Returned in the response content are two links, "<https://example1>" and "<https://example2>".

Example one is the link to the next page of data, but I’m having trouble extracting just the url between the ‘<‘ and the ‘>’. I’m not an experienced Regex user so I figured I would ask here for help.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

my @urls = $text =~ /<([^<>]+)>/g;
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading