Jelrey
(Mohamed Salutin)
August 31, 2020, 6:03am
1
I wanted to extract the data between 3 - 8 digit number and 3 letter text(casplock text) using regex. Any idea would be much appreciated thank you.
Example data
06/29/20 B QM 02004946 MY HELLO WORLD XLS
OUTPUT : MY HELLO WORLD
0829/20 B QM 0948264 MY UI PATH LMN
OUTPUT: MY UI PATH
0829/20 B QM 435 MY SAMPLE DATA LMN
OUTPUT : MY SAMPLE DATA
hasib08
(Motiwala Hasib)
August 31, 2020, 6:46am
2
I am assuming that “QM” is constant.
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET.
KanadMehta
(Kanad Mehta)
August 31, 2020, 6:46am
3
Split using Regex \d{3,} and keep the last item of the array. You will get below text (including last 3 letters)
MY HELLO WORLD XLS
MY UI PATH LMN
MY SAMPLE DATA LMN
Then remove last 3 characters and you have what you want
myString.Substring(myString.Trim.Length-3)
cemuza
(Fabio Oliveira)
August 31, 2020, 11:24am
4
Here you can have a regex string for what you want, and the test cases tested:
(?<=\d{3}\s)([\w\s]*)(?=\s\w{3})
1 Like
Hi @Jelrey ,
try this regex (?<=\d)\s[A-Z]+[A-Z]+[A-Z]+
Below is for your reference
if this solves your question then mark this as a solution.
Regards,
Aditya
1 Like
system
(system)
Closed
September 3, 2020, 11:32am
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.