Link to home
Start Free TrialLog in
Avatar of MJ
MJFlag 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
ASKER CERTIFIED SOLUTION
Avatar of Jan Louwerens
Jan Louwerens
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MJ

ASKER

Thank Jan!