Search code examples
google-sheets

Google Sheets: Using REGEX to include markdown hypertext


I have a sheet with 20+ users adding info. The sheet contains a column for "URL" but the URL with the word "visit/" must be in hypertext markdown in order for the links to be clickable on the internal dashboard. Thanks in advance!

My attempt but will not work if there is more than 1 link:

=if(REGEXMATCH(A2,"visit/"),CONCATENATE("[",A2,"](http://",A2,")"))

Example GSheet.


Solution

  • You may try:

    =map(A2:A,lambda(Σ,if(Σ="",,join(", ",map(index(trim(split(Σ,", "&char(10)))),lambda(Λ,regexreplace(Λ,"^visit/.*","[$0](http://$0)")))))))
    

    enter image description here