问题
I need to alter the below Regex to validate emails domains in a oracle database, according to RFC 5322, and ensuring that the criteria below are respected as well.
Domain rules that must be respected:
- must start an end with a letter or digit and be between 1 and 63 characters long.
- may contain uppercase and lowercase Latin letters (A to Z and a to z).
- may contain digits 0 to 9, provided that top-level domain names are not all-numeric.
- may contain hyphen -, provided that it is not the first or last character, and not consecutive also.
- must have at least 2 or more characters (abc@t.com is not valid, but abc@tt.com is valid).
I found on the internet the regex below, that works very well and ensure the rules posted above, in Javascript. My problem is that ORACLE does not support look-ahead/-behind.
@(?:(?=[A-Z0-9-]{1,63}\.)[A-Z0-9]+(?:-[A-Z0-9]+)*\.){1,8}[A-Z]{2,63}$
So, can anyone please help me on making the necessary modifications in order to work in Oracle sql?
来源:https://stackoverflow.com/questions/60870491/alter-regex-to-validate-email-domain-on-rfc-5322-from-java-to-oracle-sql