我需要字符串中包含4个大写字母的所有组。
所以我正在使用REGEXP_REPLACE([Description],'\b(?![A-Z]{4}\b)\w+\b',' ')
在Tableau
中替换所有小写字母和额外字符。我想只获得4个字符串长度的大写字母实例。
通过google我知道我不能使用Regex_extract(因为/ g不受支持)
我的字符串:
"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"
我写过[^A-Z]{4}/g
。
我想:
HIWE JADA JPBD JVCS JADQ JVDI JVDO JVTZ
但这也给了我一个大写字母和空格。
由于
答案 0 :(得分:3)
您可以使用this regex:
((?<=[A-Z]{4})|^).*?(?=[A-Z]{4}|$)
解释
( # 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
) #
任何疑问都可以随意问:)