Can C++ use regular expressions?
The main content of this article is "can C++ use regular expressions?", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next, let the editor take you to learn "can C++ use regular expressions?"
The answer must be yes, so today a simple input scanf takes you into the regular world.
# include
Int main ()
{
Printf ("input digate:")
Char str [100]
Scanf ("% [0-9]", str); / / enter 123456abc
Printf ("% s", str); / / print 123456
}
Enter any string of characters that start with a number in scanf, and only the first string of numbers in the character will be saved in str.
Input digate:123456abc
123456
First, give some simple rules.
Qualifier meaning% [0-9] numeric collection% [^ 0-9] non-numeric collection% [a-zA-Z] letter set% [^ a-zA-Z] non-alphanumeric set
Preheat up, let's get down to business.
To determine whether an input QQ number is valid, how to determine?
Judgment steps:
The length is greater than 5, less than or equal to 11; the first bit cannot be 0; is it a pure number? C++string processing: # include
Using namespace std
Int main ()
{
String qq = "7466a2063"
If (qq.length () > = 5 & & qq.length ()