Reputation: 427
I need all groups of 4 capital letters in a string.
So I am using REGEXP_REPLACE([Description],'\b(?![A-Z]{4}\b)\w+\b',' ')
in Tableau
to replace all small letters and extra characters. I want to get only instances of capital letters with 4 string length.
By google I got to know i cannot use Regex_extract (Since /g is not supported)
My String:
"The following trials have no study data-available, in the RBM mart. It appears as is this because they were . In y HIWEThe trials currently missing data are:
JADA, JPBD, JVCS, JADQ, JVDI, JVDO, JVTZ"
I have written [^A-Z]{4}/g
.
I want:
HIWE JADA JPBD JVCS JADQ JVDI JVDO JVTZ
But this is also giving me single capital letter and space included.
Thanks
Upvotes: 1
Views: 762
Reputation:
You can use this regex:
((?<=[A-Z]{4})|^).*?(?=[A-Z]{4}|$)
Explaining:
( # one of:
^ # the starting position
| # or
(?<=[A-Z]{4}) # any position after four upper letters
) #
.*? # match anything till the first:
(?= # position which in front
[A-Z]{4} # has four upper letters
| # or
$ # is the string's end
) #
Any doubt feel free to ask :)
Upvotes: 3