简体   繁体   English

Spotfire 中的正则表达式

[英]Regex Expressions in Spotfire

I'm trying to use RXExtract as a calculated column to dissect [column1] by it's values.我正在尝试使用 RXExtract 作为计算列来按其值剖析[column1] [column1] looks like "location- 1234 (abc)" and I'd like to just separate the "1234" out of it. [column1]看起来像“location- 1234 (abc)”,我想将“1234”从中分离出来。

My current code in Spotfire is RXExtract([SM Code], '(\d)(\d)(\d)(\d)', 1 ) but I get an "invalid escape sequence error".我在 Spotfire 中的当前代码是RXExtract([SM Code], '(\d)(\d)(\d)(\d)', 1 )但我收到“无效的转义序列错误”。 Where am I going wrong?我哪里错了?

Thanks!谢谢!

Try尝试

RXExtract([SM Code], '\b\d{4}\b', 1)

this will match any four consecutive or unconsecutive digits.这将匹配任何四个连续或不连续的数字。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM