Condition to see if the string starts with three letters and the rest are numbers

Hello everyone,

I have a .txt file from which I read a large text, filled with strings. However, I just want to get the strings that start with three letters and the rest are numbers (example: BTV1138903 or BCU507).
How could I make this kind of condition?

I’ve been trying to solve this problem for a few days and I still haven’t succeeded

Somebody help me please :slight_smile:

Use regex activities, IsMatch and Matches
Specify input as your text from.txt file
Pattern as [A-Z]{3}[0-9]*

For more references see

1 Like

Use this regex where MyStr is your string:

MyStr = System.Text.RegularExpressions.Regex.Match(MyStr, "[A-z]{3}\d+").Value.


Thanks everyone for the answers! They helped me a lot, especially Anthony_Humphries’s

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