I need to modify a regular expression that matches a url for a redirect. The main part of it is this:
#^/webpages/ProdPage.aspx|^/default.asp#
That (i think) matches all the occurence that comes from webpages/ProdPage.aspx
or default.asp
. I need to modify it so that it will match default.asp
or Default.asp
. Maybe I should just add an i
after the delimiter but I don't want the entire expression to be case insensitive.
thanx Luke
Change your default.asp
to [dD]efault.asp
to allow just the d
to be lower or upper case.
Additionally, you might consider changing your .
to \\.
as you want it to match a literal dot (ProdPage.aspx, default.asp). Otherwise, .
will be interpreted in its regex sense meaning "any character except newline", so a page webpages/ProdPageaaspx
would match (even though it's extremely unlikely...)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.