Extract only characters from string

So i have scraped some data to data table that looks like this
95 package”

how I can extract only the “picker-1”?

p.s the “95 package” are in the new line but one row

1 Like

Hey @Fauzan_Marantama,

You can use string.split function after reading that data from a cell.

Split by either Environment.Newline or spaces which gives you the array of words separated by the spaces or newline.

Access the first element is the array which gives you the output.

Thanks :slight_smile:

we can use Regex in case of we want to ensure some value content presence.

E.g. picker is fixed, number can be different:

or another pattern

1 Like

thank you for the answer, is there any coding example?

sorry, the image doesnt load at all, can you change the image source link?

another try for image:




still error, i think there is problem with the domain (500 origin error)


and if the picker name are based on the name, e.g
0 package”
can it extract only the fauzanpicker? already tried newline split, but the result is still the full text

so lets change the pattern to and give a try:


for working with regex have a look here:

However it is recommended that you will collect of text variations and share the set with us. Based on this we can work out the most close matching solution approach. Here we want just check if regex or


will better match to your case

1 Like

thank you, marked as solutions

this is c# code sample.

my conditions is that

  1. ‘picker’ must is before ‘-’.
  2. one number digit must be at end.

reference below.

string pattern = @"\w+-\d";
string src = @"picker-1
95 package";
MatchCollection matches = Regex.Matches(src,pattern);
string[] arr = matches.Cast < Match >().Select(m => m.Value).ToArray();

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.