Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 Alteryx,我有一个名为 Address 的字段,它由 A32C、GH2X、ABC19E 等字段组成。所以基本上数字被固定在字母集之间。我正在尝试使用 RegEx 工具将数字提取到一个名为 ADDRESS1 的新列中。
我将地址设置为要解析的字段。输出方法解析。我的正则表达式输入为:
(?:[[alpha]]+)(/d+)(?:[[alpha]]+)
然后我有 (/d+) 输出到 ADDRESS1。但是,当我运行它时,它会解析 0 条记录。我究竟做错了什么?
要匹配数字,请使用[0-9]或\d。要匹配一个字母,请使用[[:alpha:]].
[0-9]
\d
[[:alpha:]]
采用
[[:alpha:]]+(\d+)[[:alpha:]]+
请参阅正则表达式演示。
你可以试试这个:
let regex = /(?!([A-Z]+))(\d+)(?=[A-Z]+)/g; let values = 'A32CZ, GH2X, ABC19E' let result = values.match(regex); console.log(result);