If you’re validating user input, you’ll likely want a more complex regex, because the user could type in anything.
If there is an apostrophe, it must be in the 2nd postion only (e.g. If at least one character is required, then use this: (? She showcases ways she's making a difference through the Colors of STEM program. :[a-z]'[a-z][a- Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women.Turning on this option allows you to type match a literal @ sign and a dot, respectively.Since the dot is a metacharacter when used outside character classes, it needs to be escaped with a backslash.Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S. :[a-z -]'[a-z][a-z -]*|[a-z -]*)$ The above also allows an empty string though, as you haven't said to disallow it. Question: I have an application where I need to ensure that my end-users don't use special characters in the name columns for the full name of a person. Answer: To validate first name and last name fields from an Oracle application (APEX or SQL*Forms) the regular expression DECLARE v_name varchar2(20) := '^[a-z A-Z–] $' --- Only alpha, space and dashes BEGIN If not regexp_like(last_name,v_name) then dbms.output.put_line(' Invalid surname'); . Please re-enter'); The landmark book "Advanced Oracle SQL Tuning The Definitive Reference" is filled with valuable information on Oracle SQL Tuning. END You can also use regular expressions to validate names at data entry time within your application, ensuring that only valid name characters are entered: if not regexp_like (first_name, '^[a-z A-Z .''-] $') or not regexp_like (middle_name, '^[a-z A-Z .''-] $') or not regexp_like (last_name, '^[a-z A-Z .''-] $') then dbms_output.put_line('Invalid characters in names.All the regular expressions, except the “simple” one, require the case-insensitive matching option to be turned on.Otherwise, only uppercase characters will be allowed.