Skip to main content
Update
Source Link
Duc Le
  • 3.8k
  • 2
  • 8
  • 28

Using AMPscript RegExMatch function would help to get the URL.

TryUpdate to get both URL and link text. Try this:

%%[
  set @html = AttributeValue('Your column name'); 

  set @pattern@url_Pattern = '(?<=href=").*(?=")'
  set @linkText_Pattern = '(?<=>).*(?=<a>)' 

  set @url = RegExMatch(@html, @pattern@url_Pattern, 0)
  set @linkText = RegExMatch(@html, @linkText_Pattern, 0)
]%%

URL: %%=v(@url)=%%<br>
Link Text: %%=v(@linkText)=%%

Reference: RegExMatch function

Using AMPscript RegExMatch function would help to get the URL.

Try this:

%%[
  set @html = AttributeValue('Your column name');
  set @pattern = '(?<=href=").*(?=")'
  set @url = RegExMatch(@html, @pattern, 0)
]%%

%%=v(@url)=%%

Reference: RegExMatch function

Using AMPscript RegExMatch function would help to get the URL.

Update to get both URL and link text. Try this:

%%[
  set @html = AttributeValue('Your column name'); 

  set @url_Pattern = '(?<=href=").*(?=")'
  set @linkText_Pattern = '(?<=>).*(?=<a>)' 

  set @url = RegExMatch(@html, @url_Pattern, 0)
  set @linkText = RegExMatch(@html, @linkText_Pattern, 0)
]%%

URL: %%=v(@url)=%%<br>
Link Text: %%=v(@linkText)=%%

Reference: RegExMatch function

Source Link
Duc Le
  • 3.8k
  • 2
  • 8
  • 28

Using AMPscript RegExMatch function would help to get the URL.

Try this:

%%[
  set @html = AttributeValue('Your column name');
  set @pattern = '(?<=href=").*(?=")'
  set @url = RegExMatch(@html, @pattern, 0)
]%%

%%=v(@url)=%%

Reference: RegExMatch function