L
L
libera2016-03-23 16:22:22
C++ / C#
libera, 2016-03-23 16:22:22

Regular expressions on lines or multiple values?

string pattern = @"\d"; //
            if (Regex.IsMatch(textBox.Text, pattern, RegexOptions.IgnoreCase))
            {              
            }
            else
            {
                MessageBox.Show("Ошибка: Регистр букв должен быть большим и на Английском языке.");
            }

Everything works, but there should be a letter + number check in the string, if done one by one it works fine.
I have an example 545IVAN I
need to check. Whatever could be numbers and letters.
The example above that checks only numbers and it works, but it also needs to check letters.
string pattern = @"\d+[A+Z]"; //
I tried that, but it doesn't work.
He needs to lead the beginning of the number then the letters, otherwise the error, even if there are 2 numbers, and then the letters

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2016-03-23
@zagayevskiy

Learn regular expressions. Well, for example: professorweb.ru/my/csharp/charp_theory/level4/4_10.php
You need a character |
PS This is me giving you a fishing rod instead of fish, if that

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question