Have said this.
It contains only alphabets.
It contains combination of alphabets and above special characters.
it contains only all spaces.
Except for spaces it should not be simply special characters as ......, ----------, ''''''''.If input starts with alphabets - then should be followed by either one or more alphabets or above said special chars
If input starts with above said special chars - then should be followed by one or more alphabets
If input starts with space, then it can all together have space in it.
Here is the given of inputs with valid and invalid cases.
demo@ORA12C> select 'valid' as x, q'#ORACLE#' as y from dual union all
2 select 'valid' as x, q'#ORA..C L--E#' as y from dual union all
3 select 'valid' as x, q'#''..O#' as y from dual union all
4 select 'valid' as x, q'#O--...'''#' as y from dual union all
5 select 'valid' as x, q'# #' as y from dual union all
6 select 'In-valid' as x, q'#........#' as y from dual union all
7 select 'In-valid' as x, q'#''''''''''#' as y from dual union all
8 select 'In-valid' as x, q'#--------#' as y from dual union all
9 select 'In-valid' as x, q'#ORACLE$#' as y from dual union all
10 select 'In-valid' as x, q'#ORACL#E#' as y from dual union all
11 select 'In-valid' as x, q'#ORACLE(#' as y from dual;
X Y
-------- -----------
valid ORACLE
valid ORA..C L--E
valid ''..O
valid O--...'''
valid
In-valid ........
In-valid ''''''''''
In-valid --------
In-valid ORACLE$
In-valid ORACL#E
In-valid ORACLE(
11 rows selected.
Here is the regex that replaces all the valid values into null values.
demo@ORA12C> set null ?
demo@ORA12C> col x1 format a10
demo@ORA12C> select x,y,
2 regexp_replace( y ,
3 '(^([a-z]|[A-Z])([a-z]|[A-Z]|\s|''|\.|\-)+)|^(\s|''|\.|\-)+([a-z]|[A-Z])+|^\s+$') x1
4 from (
5 select 'valid' as x, q'#ORACLE#' as y from dual union all
6 select 'valid' as x, q'#ORA..C L--E#' as y from dual union all
7 select 'valid' as x, q'#''..O#' as y from dual union all
8 select 'valid' as x, q'#O--...'''#' as y from dual union all
9 select 'valid' as x, q'# #' as y from dual union all
10 select 'In-valid' as x, q'#........#' as y from dual union all
11 select 'In-valid' as x, q'#''''''''''#' as y from dual union all
12 select 'In-valid' as x, q'#--------#' as y from dual union all
13 select 'In-valid' as x, q'#ORACLE$#' as y from dual union all
14 select 'In-valid' as x, q'#ORACL#E#' as y from dual union all
15 select 'In-valid' as x, q'#ORACLE(#' as y from dual
16 )
17 /
X Y X1
-------- ----------- ----------
valid ORACLE ?
valid ORA..C L--E ?
valid ''..O ?
valid O--...''' ?
valid ?
In-valid ........ ........
In-valid '''''''''' ''''''''''
In-valid -------- --------
In-valid ORACLE$ $
In-valid ORACL#E #E
In-valid ORACLE( (
11 rows selected.