Russell Christopher
Russell Christopher

Reputation: 1707

What does this RegEX replace expression do?

Folks, I'm a regex newb, and can't suss out what this sucker is doing (btw - %1 is replaced by values coming from a database column which represents a domain like "local" or "stackoverflow.com"):

regexp_replace(%1,E'[.]','%'||'2E', 'g')

I'm assuming the E above is doing some sort of global conversion - ucase/lcase/unicode/ANSI, etc...but I can't find a reference. It also looks like we're OR-ing the potential replacement characters (% or 2E? Why?) but I'm at a loss.

Thanks much.

Upvotes: 1

Views: 181

Answers (1)

Toto
Toto

Reputation: 91385

It will replace every dot character by %2E wich is the urlencoded of .

i.e: stackoverflow.com becomes stackoverflow%2Ecom

The || operator is the concatenation operator not the OR operator.

Upvotes: 1

Related Questions