I created Azure CDN with an endpoint under the Verizon Premium subscription. Then I've logged to the Azure Verizon platform to add a new rule to the engine. If there is no extension at the end of URL, then the .html is added automatically. In the Azure Verizon it looks like this:
However, if you replace the
.+\/[^\.]\w+$
with ^.*/[^/.]+$
it won't work the same don't know why and no validation errors appear. After I read this article my suspicious is there is something to do with the regular expression flavor but I am not sure at all.

- 2,918
- 5
- 25
- 63
-
Does it support `\w`? Try `.+\/[^.][0-9a-zA-Z_]+$` – Wiktor Stribiżew Dec 12 '18 at 14:55
-
I think so. Ok, ill try this as well – GoldenAge Dec 12 '18 at 14:57
-
Nope, it doesn't seem to work in Azure Verizon. – GoldenAge Dec 12 '18 at 16:10
-
I can try to check more regex expressions if it helps you to discover what kind of engine it uses – GoldenAge Dec 12 '18 at 16:14
-
In the screenshot, you have source text starting with `/`, maybe the `.+` does not let it work. Maybe you need `.*`. Besides, the URL Rewrite hints at the ECMAScript 5 regex standard, and the one above is compliant with it. So, probably the problem is not the regex, but how it is used. The order of rules even. – Wiktor Stribiżew Dec 12 '18 at 16:53
-
I've checked once again and now the `.+\/[^.][0-9a-zA-Z_]+$` works in Azure Verizon – GoldenAge Dec 13 '18 at 16:11
-
I doubt you need to escape `/` there. – Wiktor Stribiżew Dec 13 '18 at 17:58
1 Answers
When you are not sure of the regex engine used, try to only use the most common regex constructs, like .
, *
, [...]
. So, instead of \w
, try [a-zA-Z0-9_]
.
Do not escape anything inside [...]
, mind that to do that you need to put ]
right after the initial [
(not in ECMAScript flavor, you will have to escape ]
inside a character class there), -
can be put at the end of the character class unescaped, ^
should not be at the beginning. Note that \
can be escaped only in NFA regexps, in POSIX based ones, inside bracket expressions, \
is parsed as a literal \
char as POSIX bracket expressions do not support regex escapes inside them. It makes no sense to escape a .
inside [...]
, the [\.]
is an invalid pattern in JS ES6 regex when compiled with u
modifier. So, it is safer to write [^.]
.
Regex delimiters are only used in some programming languages to define regexps, but in software like this you only deal with string patterns. Thus, /
is not any special and does not have to be escaped.
So, I'd use the following regex here:
.+/[^.][0-9a-zA-Z_]+$

- 607,720
- 39
- 448
- 563
-
1I received this message from Verizon support "Regex is very flexiable expression. So you can come up with multiple ways to achieve the same desired result. Verizon platform is not tailored towards a specific flavor of Regex, as long as the Regex is in proper syntax, it should work." I think your answer makes perfect sense, so im gonna to accept it. Thanks – GoldenAge Dec 18 '18 at 09:15