JSFiddle - React, Tailwind, and code Playground

JavaScript

var html = "<a href='http://path/to/file.pdf'>File</a>";

var result = html.match(/href='([^']+)'/)[1];
    
    alert(result);