Hello I have a column full of data such as
ABCD1
ABCD2
ABCD3
ABCD3_01
etc.
I wanted to the column to show only
1
2
3
3_01
What should I enter here in the Regular Expression session of the REGEX tool?
I tried multiple ways, but it's not working for me. Thank you for your help!
Solved! Go to Solution.
Depending on what other data you might have in your fields, it actually might be as easy as using a Data Cleansing tool and just checking the box to remove any letters.
You could use some RegEx with an expression like (\d+\D*\d*) or similiar if needed.
Using the formula Tool or Replace functionality REGEX tool should work with this:
REGEX_Replace([Field1], "^\D+(\d.*)$", "$1")
In case you use the Regex Tool:
^\D+(\d.*)$ - Expression
$1 - Replacement
Although it really depends on your data.
Cheers,
@NickSm Thank you! it worked. Can you tell me a little bit about what does "\D" mean in this expression? i tried to play around with the "\d", but it either come with just the number or only the _01 part.
Sure!
\d signifies a digit character. Capitalizing it to a \D signifies a non-digit, which should catch your underscore character. Then the additional \d* catches any digits that may or may not follow the underscore.