Home > Blockchain >  Regex match - ignore regex rules though and match exact text
Regex match - ignore regex rules though and match exact text

Time:11-10

I have many URLs that are somehow having the following text appended to them:

/example-title\';/

The URL should simply be:

/example-title/

So I tried this redirect regex:

^/(.*)\';/

redirects to

/$1/

But my software thinks that the \'; part is also regex and strips it out.

Is there any way to encapsulate the \'; part so that the "regex engine" doesn't try and process it as regex and just processes it as plain text?

CodePudding user response:

Looks like the value \ is a backslash but it is URL encoded:

Try this:

([^\/]*?)\x5C\x27\x3b
  • Related