At this time the Spreadsheet Service of Google Apps Script is not able to get the properties of cells rich text content, just the plain text by using getValue() method. Other methods like getFormula(), getNote() are able to get the corresponding cell property, but none of the them includes the URL of the link.
=TRIM(REGEXEXTRACT(REGEXREPLACE(A2;"\[URL=";""); "https://[\w/\-?=%.]+\.[\w/\-?=%#.]+"))