Search code examples
google-sheets

Google Sheets: Commas Disappearing with Regexreplace


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. The issue is that the commas are disappearing. Thanks in advance.

URL Formula Result I want
visit/settings, visit/profile visit/settings visit/profile visit/settings, visit/profile

Example Google Sheet.

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

Solution

  • You may try:

    =map(A2:A,lambda(Σ,if(Σ="",,regexreplace(Σ,"visit/[\w-]+","[$0](http://$0)"))))
    

    enter image description here