How to use regexp for the following?

4 次查看(过去 30 天)
I want to use regexp for the following string 'ME5708' ,
S[lower( 'o the first two characters should be uppercase alphabets and the next four characters should be numbers')]
(don't shout--dpb)

采纳的回答

Guillaume
Guillaume 2020-1-20
If you want to extract two uppercase letters followed by four digit:
regexp(yourinput, '[A-Z]{2}\d{4}', 'match')
I recommend that you try to learn regular expression. This particular expression is very simple.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 String Parsing 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by