Avatar of MJ
MJ
Flag for United States of America

asked on 

JS Regex for first level directory with/without Query String?

What would the JS regex be for a directory "/m/" ("m" is the actual directory name) with or without a query string? No file name will ever show, only a possibility of query strings.  Regex has to fail if another directory is present. This is the first level dir on a website which is the value returned by location.pathname. Examples:

Yes - /m/
Yes- /m/?a=b
No - /m/n/
No - /m/n/?a=b
JavaScript

Avatar of undefined
Last Comment
MJ

8/22/2022 - Mon