<regex> - C++ Reference

文章推薦指數: 80 %
投票人數:10人

Regular expressions are a standardized way to express patterns to be matched against sequences of characters. The standard C++ library provides support for ... Search: Reference header RegularExpressions Regularexpressionsareastandardizedwaytoexpresspatternstobematchedagainstsequencesofcharacters. ThestandardC++libraryprovidessupportforregularexpressionsintheheaderthroughaseriesofoperations.Alltheseoperationsmakeuseofsometypicalregexparameters: Targetsequence(subject):Thesequenceofcharacterssearchedforthepattern.Generally,thisisarangespecifiedbytwoiterators,butsomefunctionsalsoacceptac-stringorastringobjectinstead. Regularexpression(pattern):Thepatternwhichissearchedforinthetargetsequence.Thismustbeanobjectofabasic_regextype(suchasregex),generallyconstructedfromastringwithaspecialsyntaxthatdescribeswhatconstitutesamatch(seeECMAScriptsyntax). Matchesarray:Someoperationsallowtoretrieveinformationaboutmatches.Thisinformationisstoredinoneofthespecialmatch_resultsarraytypes(suchascmatchorsmatch). Replacementstring:Someoperationscanreplacematches.Thesereplacementsarespecifiedinstringsthatallowforaspecialformat(seeECMAScriptsyntax). Regexoperations Regexoperationsareperformedusingeitherfunctionsorspecialiteratoradaptors: Functions: regex_matchMatchsequence(functiontemplate )regex_searchSearchsequence(functiontemplate )regex_replaceReplacematchedsequence(functiontemplate ) Iteratortypes: regex_iteratorRegexiterator(classtemplate )regex_token_iteratorRegextokeniterator(classtemplate ) Classes Theregexfunctionsanditeratorsmakeheavyuseofasetofsupportingtypesasargumentsandreturnvalues: Basictypes: basic_regexRegularexpression(classtemplate )match_resultsMatchresults(classtemplate )sub_matchSub-expressionmatch(classtemplate )regex_traitsRegextraits(classtemplate )regex_errorRegexexception(class ) Someofthesetypesaretemplates,andhavealiasesfortheirmostcommoninstantiations: basic_regexinstantiations: regexRegex(class )wregexRegexforwchar_t(class ) match_resultsinstantiations: cmatchmatch_resultsforstringliterals(class )wcmatchmatch_resultsforwidestringliterals(class )smatchmatch_resultsforstringobjects(class )wsmatchmatch_resultsforwidestringobjects(class ) sub_matchinstantiations: csub_matchsub_matchforstringliterals(class )wcsub_matchsub_matchforwidestringliterals(class )ssub_matchsub_matchforstrings(class )wssub_matchsub_matchforwidestrings(class ) Namespaces Thisheaderalsodefinesanamespace,regex_constants,underwhichallconstantvaluestobeusedbythelibraryarelocated: regex_constantsregexconstants(namespace ) Grammar Regularexpressionsfollowverystrictgrammars.Bydefault,thefunctionsinthislibraryusetheECMAScriptgrammar: ECMAScriptsyntaxECMAScriptregularexpressionspatternsyntax(syntaxspecifications ) Otherfunctions beginIteratortobeginning(functiontemplate )endIteratortoend(functiontemplate ) C++ Information Tutorials Reference Articles Forum Reference Clibrary: (assert.h) (ctype.h) (errno.h) (fenv.h) (float.h) (inttypes.h) (iso646.h) (limits.h) (locale.h) (math.h) (setjmp.h) (signal.h) (stdarg.h) (stdbool.h) (stddef.h) (stdint.h) (stdio.h) (stdlib.h) (string.h) (tgmath.h) (time.h) (uchar.h) (wchar.h) (wctype.h) Containers: Input/Output: Multi-threading: Other: ECMAScriptsyntax regex_constants classes(basic): basic_regex match_results regex_error regex_iterator regex_token_iterator regex_traits sub_match classes(templateinstantiations): cmatch csub_match regex smatch ssub_match wcmatch wcsub_match wregex wsmatch wssub_match functions: regex_match regex_replace regex_search Homepage|Privacypolicy©cplusplus.com,2000-2022-Allrightsreserved-v3.2Spottedanerror?contactus



請為這篇文章評分?