1

I am running into an issue where I can't seem to exclude certan strings like "registration and login" from my regex. I am trying to get URLs that contain /bag/order/orderinfo.aspx and anything after that path, but the issue is that it is picking up on certain url referrer paths and additional parameters that do not lead to the correct pages I am trying to use. I tried [^registration|login] before the /Bookbag, but that didn't do anything

Here is my regex:

\/Bookbag\/order\/OrderInfo\.aspx.*

Currently picking up on all of the following URLs, but I only want to include these three paths:

http://test.com/bag/order/orderinfo.aspx
http://test.com/bag/order/orderinfo.aspx?empty=0&txttarget=
http://test.com/bag/order/orderinfo.aspx?txttarget=

Not these links, which are currently being picked up by my current RegEx setup:

urlreferrer=http://test.com/catalog/&returl=http://test.com/bag/order/orderinfo.aspx&cancelurl=http://test.com/catalog/login

http://test.com/bag/registration/registrationcheckout_aboutyou.aspx?type=checkoutwithoutreg&email=test&txttarget=http://www.test.com/bag/order/ordercourseinfo.aspx\

1 Answer 1

1

You can use negative lookahead regex like this:

/^(?!.*(registration|login)).*?\/bag\/order\/OrderInfo\.aspx.*$/gmi

Javascript RegEx Demo

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.