Forum Stats

  • 3,722,784 Users
  • 2,244,413 Discussions


Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

regular expression in sql with mandatory and optional charcters and minimum 3 chr length

User_NPWZ2 Member Posts: 1 Red Ribbon


I wantto write an regular expression pattern where input string should match if it optionally has special charcters: &'.-\/:;`~_$space

and mandatorily it should have aphabets A-Za-b. Also length of string should be minimum 3 char

I tried..

select 1 from dual where regexp_like(' A ', '[&?\''?.?-?\\?\/?`?:?;?_?~?`?[:space:]?[A-Za-z]]{3,}')

Here when i provide '  ' (3 spaces) it is giving output as 1. whereas it should give null

My expected output is:

when input ' A ' output 1

when input '  ' output null

when input 'A ' output 1

when input ' A' output 1

Sign In or Register to comment.