A Brief Introduction to boost Regular Expression Library

Source: Internet
Author: User

Address: http://www.cppblog.com/walkspeed/archive/2007/12/28/39823.html

Header file RegEx. HPP

Common classes
Boost: RegEx Regular Expression

Boost: cmatch uses the char array as the container to store matching return values.
Boost: smatch uses STD: string as the container and stores the matching return value.

Boost: regex_match matchAlgorithm
Boost: regex_search Search Algorithm
Boost: regex_replace replacement algorithm

Simple Example

# Include <iostream>

# Include <boost/RegEx. HPP>

Int main (INT argc, char * argv [])
{
Char * Buf = "this is boost: RegEx example ";

Boost: RegEx exampleregex ("Boost: RegEx ");
Boost: cmatch result;

If (boost: regex_search (BUF, result, exampleregex ))
{
STD: cout <result. STR () <STD: Endl;
}

Return 0;
}

Compile: G ++-g-wall-O0 Reg. CC-O reg-lboost_regex// Boost_regex the Regular Expression Library requires additional installation

Note the inclusion of RegEx. HPP. You need to set the seat of the boost header file in the development tool.

End

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.