There is a line that I get by accessing document.location.pathname - / airlines / su / .
What do I need to do with this line? Initially, you need to check if the line contains something other than /airlines/ . I wanted to do this with a regular expression that checks if the line is suitable for /airlines/NN/ , but I don’t know how to do it. There is an option to take the length of the string /airlines/ and compare it with the fact that in document.location.path , but it will work under the condition if you write anything in the address bar. Therefore, this option is not suitable. But besides the fact that I need to check this line, I also need to cut out two characters: /airlines/ NN / . And finally, you need to check whether these two characters are NN alphanumeric and they must contain strictly two characters. Options that fit: s7, su, ps, a1. Is there some elegant way to do this in a couple of lines? And then my description looks too cumbersome.
^\/airlines\/([az\d]{2})\/$- teran