378 views
2 votes
Using wildcard metacharacters, how can one indicate a number is either 1, 2, 3, or 4?

User Justine
by
6.6k points

1 Answer

2 votes
using the current "regular expressions" in use in Java, Perl, and many other applications, this belongs to "character class" using the [ ] notation.
For characters "either" 1,2,3,4, we write
[1234]
or in this particular case,
[1-4]
User Hgl
by
6.0k points