GoldenAge
GoldenAge

Reputation: 3068

What regular expression engine does the Azure Verizon use?

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: enter image description here 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.

Upvotes: 2

Views: 416

Answers (1)

Wiktor Stribiżew
Wiktor Stribiżew

Reputation: 626932

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_]+$

Upvotes: 3

Related Questions