Need to select a specific numbers

Need to select the 11 numbers before the 2 last numbers

11 numbers before the number 30

image

Hi,

Could you please try with substring function in string manipulation like below.

substring(startindex,length) to achieve your goal.

In our case yourstring.substring(7,11)

1 Like

Hi @kirankumar.mahanthi1

The full number is a variable the length it is not the all the time

Hey

We can use Regex to accomplish this.

Please tell us some more so we can help

  1. Have you got. More samples
  2. Please bold the expected output.
  3. Tell us about the pattern. What is consistent etc.

Is the 30 alway there?
What is the length of the digits in the middle?
Will there always be capital letters at the start and a letter at the end?

I have created a starter Regex pattern to assist.

Here is a link to preview.

Please check out my Regex MegaPost if you want to learn Regex.

1 Like

Hi @Steven_McKeering

Thank you for your reponse.

The all sentence can change, 30 is not always there but the 2 last number are always numbers

In the all sentence it can have letters or not. The lengh is always more than 11 numbers

so what i need is a regex that removes the last 2 digits then gets the 11 digits before the last 2 digits. In my example, take the 11 digits before the number 30

Hey

How about this pattern. It will match 11 or more digits.

\d{11,}

1 Like

Oh sorry i need to take also the letters

Which letters sorry :sweat_smile:

Will they always be capitals also?

Try this pattern:
[A-Z]+\d{11,}[A-Z]+(?=\d{2})

2 Likes

@Steven_McKeering

With is example it will be better :


The all thext is that : FR 33 30002 00550 0000157841Z 25
This is whats i need :

Code banque : 30002
Code guichet : 00550
Numéro de compte : 0000157841Z
Clé rib : 25

Is it not easier to use substring ?

The structure is always the same even if we change the numbers or letters

Hi @Soudios ,

Can you give a try with this regex. and check if this works.

1 Like

Hi,

One last try with the substring fucntion.

First replace the space with the empty → stringvalue.Replace(" “,”")

Next substring to get the desired string irrespective if length.

→ Stringvalue.Substring(cint(Stringvalue.Length-13),11)

Could you please try and let me know. thanks

1 Like

@kirankumar.mahanthi1

it doesn’t takes the four “0” before
It takes : 157841Z only

I am getting the correct output. could you please review the attached work flow. thanks.

SubstringDemo.zip (2.2 KB)

1 Like

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