How do I write a regex that ignores strings starting with a particular prefix, and captures everythi
- by Mark Rogers
Background:
I'm trying to come up with a regex for a rewrite rule that will take anything that does not start with a particular prefix, and add that prefix to it. But urls that already have the prefix should be rejected by the regular expression (because they already have the url).
Example:
If the prefix is s1 a string like home will capture the home part. But a string like s1/home, will not capture anything.
This way I can add the capture group onto the prefix, so that 'home' will become 's1/home'.
I've tried (^s1/), but I'm missing something here, because that rejected 'home' for some reason.