The site is eating my responses here, probably because the regex looks threatening. I’ve reposted a few times in the hope of getting it to be more acceptable. I hope this doesn’t show duplicates…
Try this:
Source: %^(/path/to/url)(.*)%gi
Target: /path/to/url$2
That matches “/PaTH/to/UrL/foo” and returns “/path/to/url/foo”.
The surrounding ticks are delimiters. A regex can be surrounded by many different defined delimiters like @
or %
. (I tried to use escaped backticks here but this site filtering really doesn’t like it. After the regex is a flag that says overall how the regex is processed. The ‘g’ says everything must match in some way rather than having it do the redirect just based on the first match available. The ‘i’ says the entire regex is case insensitive.
For individual characters, use a syntax like [a-zA-Z], which means a single character can be any A-Z character, upper or lower case. If you just want to match the P in Path, for example, in a case-insensitive mode, use something like “\/[pP]ath…”.
HTH
-
This reply was modified 7 years, 7 months ago by
Tony G. Reason: Had to fix backticks intercepted by the site