Regular expression

I am new to regular expressions and any help is much appreciated.

  • Sample like W00000, W00001, W00002, W00004
  • Need to start with W
  • Each line before the comma must have six characters
  • A line can be repeated only four times
  • Comma between
  • Do not start or end with a comma

I tried under the template, and some others, for example (^[W]{1}\d{5}){1,4}'), and none of them work correctly:

Select 'X' from dual Where REGEXP_LIKE ('W12342','(^[W]{1}\d{5})(?<!,)$')
+4
source share
3 answers

, OP , , , , , . , , , , , W00000, . , , , , W, :

^W[:digit:]{5}(,W[:digit:]{5}){0,3}$

, - , :

^W[^,]{5}(,W[^,]{5}){0,3}$

UPDATE:

:

Oracle 11g [: digit:] . [0-9], .

, Oracle 11g POSIX POSIX, [: :]. , , Oracle 11g Perl, , . :

^W\d{5}(,W\d{5}){0,3}$
+2

:

(W[^,]{5},){3}W[^,]{5}
+2

, !

^W[0-9]{5}(,W[0-9]{5}){0,3}$

W12345, ,W12345.

Edit1: ^ $ , Edit2: , Oracle 11g

0

Source: https://habr.com/ru/post/1537537/


All Articles