Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Can C++ use regular expressions?

Shulou Source: shulou.com Published: 2022-06-01 20:48:24 09月25日 Update

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 ()

Tags: Characters regularities positions strings fruits expressions successes numbers iterations elements functions clocked characters content patterns symbols processing search input letters commonly used Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Technology Linux MySQL Apple