Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

RegEx to make a ReturnURL optional

Making a ReturnURL optional


I need to assert that the URL has one of the following:
  • a goto
  • a returnurl
  • no return url or goto

How do I change this RegEx

            string regEx = @"https?://(" + redirectWhitelist + ")/\\?(goto|returnurl)=https?://(" + redirectWhitelist + ")";

to permit making the following portion to be optional?
                                                                                                     \\?(goto|returnurl)=https?://(" + redirectWhitelist + ")";

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of aikimark
aikimark
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 curiouswebster

ASKER

So, it was a matter of putting the whole text inside () and following with a ?
Thanks