Answerly logo
Found 0 Answers

How to embed widgets in multiple websites with regex

author picture

Fatos Bediu

CEO, answerly.io

Regex, also known as Regular Expression, is a technical functionality that allows matching text for patterns. At Answerly, we use regex pattern matching to tell the widget which website to show or hide. 


This guide assumes you've already added a website to instant embed, and you can easily access the regex option "Use regex rules," as shown in the picture below: 

answerly regex


Ensure that the instant embed code is present in all the websites to which you want to embed multiple widgets. 


Even after enabling instant embed, the code can be easily found again inside the dashboard's homepage, simply click the button "Setup Instant Embed" as seen in the picture below: 


setup instant embed



How to use regex

After selecting "Use regex rules" in the instant embed page, click the button "Add rule" as it's seen below: 

regex embed widget add rule


How to write a rule

You need only one rule per website. If you want the widget to show in example1.com, the rule will look like so:  .+example1\.com/gm


And if you want the widget to show in example2.com, then the rule would look like so: .+example2\.com/gm


As you can tell, the rule has a very simple format, and that is: 

.+your-domain-name\.your-domain-extension/gm


Adding a rule

After you've written your rule inside the modal, simply click "Add rule" and then apply the settings. 

instant embed example


The widget should now appear to the website that you've entered inside the rule.


Extra: Using subdomains

Subdomains follow the same rule pattern, except that the dot (".") is replaced with a slash + dot ("\."). 


For example to embed a widget in help.example1.com, the rule would look like so:  .+help\.example2\.com/gm




Did we answer your question?

😃 🤔 ☹️

How can we improve this answer?

Knowledge Base Software by answerly.io