0

I'm trying to convert a C# REGEX into a Oracle PLSQL compatible REGEX. This REGEX was used to validate e-mail address format.

C# REGEX

[\w!#$%&’*+\-=?\^_`{|}~]+(\.[\w!#$%&’*+\-=?\^_`{|}~]+)*@((([\-\w]+\.)+[\w]{2,})|(([0-9]1,3}\.){3}[0-9]{1,3}))

Oracle 19c Version 19.20.0.0.0

I tried different stuff and came up with the below expression,

Oracle PLSQL REGEX

^[a-zA-Z0-9!#$%&'*+\-\/=?\^_`{|}~]+(\.[a-zA-Z0-9!#$%&'*+\-\/=?\^_`{|}~]+)*@((([a-zA-Z0-9\-]+\.)+[a-zA-Z]{2,})|(([0-9]{1,3}\.){3}[0-9]{1,3}))$

But the test results doesn't match the below test case,

Can someone please help me to convert the C# REGEX into a Oracle PLSQL compatible REGEX?

3
  • Do not use \w and other shorthand character classes inside bracket expressions. Commented May 15, 2024 at 8:41
  • [\w!#$%&’*+\-=?\^_`{|}~] should be [a-zA-Z0-9!#$%&’*+=?^_`{|}~-] (swap \w for a-zA-Z0-9_, remove the \ escape characters and move - to the end). Commented May 15, 2024 at 8:46
  • However, example+"test"@gmail.com is a valid e-mail and your pattern will not match it. Commented May 15, 2024 at 8:49

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.