konsama
konsama

Reputation: 347

How to extract values from a text string using a number as delimiter?

I have a bit of a unique situation, I have a column of data that has text values:

Column

sdfsadf42lkjdflk
skld35kdfosdffj
kdfjsi78ldsfjoi

Result should look like:

Column

42lkjdflk
35kdfosdffj
78ldsfjoi

Is there a way to cut out everything before a number? A generalized way would be nice in the event that number currently not included can still be evaluated for (the instance of a number always being used is the only constant)

Upvotes: 0

Views: 375

Answers (2)

horseyride
horseyride

Reputation: 21318

Assuming your column is named ColumnName, in powerquery, add custom column with formula

= Text.RemoveRange([ColumnName], 0, Text.PositionOfAny([ColumnName],{"0".."9"}))

Upvotes: 1

Varun Sharma
Varun Sharma

Reputation: 206

You can try finding the index and then slicing the str using the same index. I will show you with an example.

var str = "skld35kdfosdffj";
var firstDigit = str.search(/\d/);
str = str.slice(firstDigit,str.length);
console.log(str);

Upvotes: 2

Related Questions