Reputation:
How to extract numbers from string in spotfire ...
Example:
Input column: ACD:1234F
Output column: 1234
Help is really aprreciated
Upvotes: 2
Views: 7821
Reputation: 25142
Please look at these questions you posted and accept the answers if you feel they are correct. I know for certain they are correct.
Spotfire IF Statement in Custom Expression
how to eliminate outlier in spotfire box plots
For this case, this will extract numbers. Just replace [Column1] with what ever your column is.
RXReplace([Column1],"(?!\\d).","","gis")
Column1 NumberExtract
1a2b3c4d 1234
123abc345 123345
abc123def 123
Upvotes: 5
Reputation: 3974
the following expression uses Regular Expressions to strip all non-numeric characters from a string:
RXReplace([col], "[^0-9]", "", "g")
some samples:
INPUT OUTPUT
abc123 123
123abc123 123123
oi3eliu2h4rli24j 3242
as you notice this will simply strip the non-numerics and combine all digits into one string. it does not account for the first or second instance of a number. if you have edge cases, you'll need to share some more data for us to help.
if this solves your issue, please don't forget to accept the answer.
Upvotes: 4