You'll also see a lot of these: \
It's called a backslash and they have a very special use. They "escape" the character that comes afterward and tell the computer to treat it differently.
If you don’t escape the special characters, they are treated as part of the regex.
In a URL, you have to escape the periods:
helloworld\.html
This tells the computer that you mean helloworld -dot- html, not helloworld -any character- html.
You will also need to escape slashes (/) and you will end up with a pattern like this:
\/
Put them together, and you will get:
site.com\/articles\/helloworld\.html
Example: Targeting a Path
You can use regular expressions to target very specific paths in your site, for example,
http://staging.company.com/section/cart?promo=749387493
where the "749387493" is a promo code appended to a URL via query string.
To use this example, you would add the following to your regex fields: Subdomain: TLD: Path: |
In the Target tab, it will look like this:
and in the regex validator, you can see what the whole URL will look like to Qualaroo:
The purple arrows are where Qualaroo automatically escapes the periods and slashes in between the three fields.
The pink arrows are where you escape the backslashes, periods, and question marks that we want to include in the URL.
The green arrow at the end of the regex shows where the period-asterisk regex pattern is left unescaped, because those are special characters that are part of the regex.
Comments
0 comments
Article is closed for comments.