Variable consists of 15 digits number, I want to read first 4 digit, next 5 digit & rest. How to read those value

Hi Developers,

Greetings… I request a solution, Variable consists of 15 digits number, I want to read first 4 digit, then next 5 digit & rest. how to segrecate read those value.


Hi @Majunu09,

Have you tried using Substring?

"First 4 digits: "+ str_Variable.Substring(0,4)+vbNewLine+
"Next 5 digits: "+str_Variable.Substring(4,5)+vbNewLine+
"Rest of digits: "+str_Variable.Substring(9)



1 Like

@Daniela_Colina ,
Hi Thank you for the reply, I am getting this value
this first 4: 123.
next 5 digit : 56789
rest value coming good.

have a look on the regex option:

refering to groups:

find some help on Regex also here:

1 Like

@ppr , Whenever I try regular expression, I get confuse can you explain me. how to do it.


Pattern: \b(\d{4})(\d{5})(\d+)\b
refer also to the linked CheatSheet for some more help / information

1 Like

If you want to learn Regex - check out my Regex MegaPost particularly Section 5 - Learn Regex in 60mins

“\d” means a digit.
The curly brackets mean “how many times”. {5} = 5 times exactly
The + symbol means “1 or unlimited times”
The curved brackets ( ) simply break up the pattern into groups.
\b means a word barrier - like the start or end of a word.


Regex is a must for automation projects, and also to approve UiARD certification. Worth the effort learning about it

1 Like

can you share the xaml.file?


Hopefully this helps you.

Main.xaml (6.5 KB)



1 Like

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