diff --git a/doc/Attic/match_flag_type.html b/doc/Attic/match_flag_type.html index dc9c2dbe..3d6e83d1 100644 --- a/doc/Attic/match_flag_type.html +++ b/doc/Attic/match_flag_type.html @@ -31,7 +31,7 @@ character sequence. The behavior of the format flags is descibed in more detail in the format syntax guide.
-namespace std{ namespace regex_constants{ +namespace boost{ namespace regex_constants{ typedef bitmask_type match_flag_type; @@ -59,7 +59,7 @@ static const match_flag_type format_first_only; static const match_flag_type format_all; } // namespace regex_constants -} // namespace std +} // namespace boost
The type match_flag_type
is an implementation defined bitmask type
@@ -271,10 +271,10 @@ static const match_flag_type format_all;
Revised - 24 Oct 2003 + 04 Feb 2004
© Copyright John Maddock 1998- - 2003
+ 2004Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/doc/Attic/regex.html b/doc/Attic/regex.html index b0701874..dcbd7ed4 100644 --- a/doc/Attic/regex.html +++ b/doc/Attic/regex.html @@ -1,56 +1,43 @@ - - -
- |
-
-Boost.Regex- -class RegEx (deprecated)- |
-
- |
-
The high level wrapper class RegEx is now deprecated and does -not form a part of the -regular expression standardization proposal. This type -still exists, and existing code will continue to compile, however -the following documentation is unlikely to be further updated.
- -+ +Boost.Regex: class RegEx (deprecated) + + + + + + +
+ |
+
+ Boost.Regex+class RegEx (deprecated)+ |
+
+ |
+
The high level wrapper class RegEx is now deprecated and does not form a part + of the regular + expression standardization proposal. This type still exists, and + existing code will continue to compile, however the following documentation is + unlikely to be further updated.
+#include <boost/cregex.hpp>- -
The class RegEx provides a high level simplified interface to -the regular expression library, this class only handles narrow -character strings, and regular expressions always follow the -"normal" syntax - that is the same as the perl / ECMAScript -synatx.
- -+The class RegEx provides a high level simplified interface to the regular + expression library, this class only handles narrow character strings, and + regular expressions always follow the "normal" syntax - that is the same as the + perl / ECMAScript synatx.
+typedef bool (*GrepCallback)(const RegEx& expression); typedef bool (*GrepFileCallback)(const char* file, const RegEx& expression); typedef bool (*FindFilesCallback)(const char* file); @@ -72,23 +59,23 @@ synatx. // // now matching operators: // - bool Match(const char* p, unsigned int flags = match_default); - bool Match(const std::string& s, unsigned int flags = match_default); - bool Search(const char* p, unsigned int flags = match_default); - bool Search(const std::string& s, unsigned int flags = match_default); - unsigned int Grep(GrepCallback cb, const char* p, unsigned int flags = match_default); - unsigned int Grep(GrepCallback cb, const std::string& s, unsigned int flags = match_default); - unsigned int Grep(std::vector<std::string>& v, const char* p, unsigned int flags = match_default); - unsigned int Grep(std::vector<std::string>& v, const std::string& s, unsigned int flags = match_default); - unsigned int Grep(std::vector<unsigned int>& v, const char* p, unsigned int flags = match_default); - unsigned int Grep(std::vector<unsigned int>& v, const std::string& s, unsigned int flags = match_default); - unsigned int GrepFiles(GrepFileCallback cb, const char* files, bool recurse = false, unsigned int flags = match_default); - unsigned int GrepFiles(GrepFileCallback cb, const std::string& files, bool recurse = false, unsigned int flags = match_default); - unsigned int FindFiles(FindFilesCallback cb, const char* files, bool recurse = false, unsigned int flags = match_default); - unsigned int FindFiles(FindFilesCallback cb, const std::string& files, bool recurse = false, unsigned int flags = match_default); - std::string Merge(const std::string& in, const std::string& fmt, bool copy = true, unsigned int flags = match_default); - std::string Merge(const char* in, const char* fmt, bool copy = true, unsigned int flags = match_default); - unsigned Split(std::vector<std::string>& v, std::string& s, unsigned flags = match_default, unsigned max_count = ~0); + bool Match(const char* p, boost::match_flag_type flags = match_default); + bool Match(const std::string& s, boost::match_flag_type flags = match_default); + bool Search(const char* p, boost::match_flag_type flags = match_default); + bool Search(const std::string& s, boost::match_flag_type flags = match_default); + unsigned int Grep(GrepCallback cb, const char* p, boost::match_flag_type flags = match_default); + unsigned int Grep(GrepCallback cb, const std::string& s, boost::match_flag_type flags = match_default); + unsigned int Grep(std::vector<std::string>& v, const char* p, boost::match_flag_type flags = match_default); + unsigned int Grep(std::vector<std::string>& v, const std::string& s, boost::match_flag_type flags = match_default); + unsigned int Grep(std::vector<unsigned int>& v, const char* p, boost::match_flag_type flags = match_default); + unsigned int Grep(std::vector<unsigned int>& v, const std::string& s, boost::match_flag_type flags = match_default); + unsigned int GrepFiles(GrepFileCallback cb, const char* files, bool recurse = false, boost::match_flag_type flags = match_default); + unsigned int GrepFiles(GrepFileCallback cb, const std::string& files, bool recurse = false, boost::match_flag_type flags = match_default); + unsigned int FindFiles(FindFilesCallback cb, const char* files, bool recurse = false, boost::match_flag_type flags = match_default); + unsigned int FindFiles(FindFilesCallback cb, const std::string& files, bool recurse = false, boost::match_flag_type flags = match_default); + std::string Merge(const std::string& in, const std::string& fmt, bool copy = true, boost::match_flag_type flags = match_default); + std::string Merge(const char* in, const char* fmt, bool copy = true, boost::match_flag_type flags = match_default); + unsigned Split(std::vector<std::string>& v, std::string& s, boost::match_flag_type flags = match_default, unsigned max_count = ~0); // // now operators for returning what matched in more detail: // @@ -103,509 +90,392 @@ synatx. static const unsigned int npos; };- -Member functions for class RegEx are defined as follows:
- - - -
-
- | RegEx(); | -Default constructor, constructs an -instance of RegEx without any valid expression. | -- |
- | RegEx(const RegEx& o); | -Copy constructor, all the properties -of parameter o are copied. | -- |
- | RegEx(const char* c, -bool icase = false); | -Constructs an instance of RegEx, -setting the expression to c, if icase is true -then matching is insensitive to case, otherwise it is sensitive to -case. Throws bad_expression on failure. | -- |
- | RegEx(const std::string& s, -bool icase = false); | -Constructs an instance of RegEx, -setting the expression to s, if icase is true -then matching is insensitive to case, otherwise it is sensitive to -case. Throws bad_expression on failure. | -- |
- | RegEx& -operator=(const RegEx& o); | -Default assignment operator. | -- |
- | RegEx& -operator=(const char* p); | -Assignment operator, equivalent to -calling SetExpression(p, false). Throws -bad_expression on failure. | -- |
- | RegEx& -operator=(const std::string& s); | -Assignment operator, equivalent to -calling SetExpression(s, false). Throws -bad_expression on failure. | -- |
- | unsigned int -SetExpression(constchar* p, bool icase = -false); | -Sets the current expression to -p, if icase is true then matching is insensitive -to case, otherwise it is sensitive to case. Throws -bad_expression on failure. | -- |
- | unsigned int -SetExpression(const std::string& s, bool icase = -false); | -Sets the current expression to -s, if icase is true then matching is insensitive -to case, otherwise it is sensitive to case. Throws -bad_expression on failure. | -- |
- | std::string -Expression()const; | -Returns a copy of the current regular -expression. | -- |
- | bool Match(const -char* p, unsigned int flags = -match_default); | -Attempts to match the current -expression against the text p using the match flags -flags - see match flags. -Returns true if the expression matches the whole of the -input string. | -- |
- | bool Match(const -std::string& s, unsigned int flags = -match_default) ; | -Attempts to match the current -expression against the text s using the match flags -flags - see match flags. -Returns true if the expression matches the whole of the -input string. | -- |
- | bool Search(const -char* p, unsigned int flags = -match_default); | -Attempts to find a match for the -current expression somewhere in the text p using the match -flags flags - see match -flags. Returns true if the match succeeds. | -- |
- | bool Search(const -std::string& s, unsigned int flags = -match_default) ; | -Attempts to find a match for the -current expression somewhere in the text s using the match -flags flags - see match -flags. Returns true if the match succeeds. | -- |
- | unsigned int -Grep(GrepCallback cb, const char* p, unsigned -int flags = match_default); | -Finds all matches of the current
-expression in the text p using the match flags flags
-- see match flags. For each
-match found calls the call-back function cb as: cb(*this);
-
- If at any stage the call-back function returns false then the -grep operation terminates, otherwise continues until no further -matches are found. Returns the number of matches found. - |
-- |
- | unsigned int -Grep(GrepCallback cb, const std::string& s, -unsigned int flags = match_default); | -Finds all matches of the current
-expression in the text s using the match flags flags
-- see match flags. For each
-match found calls the call-back function cb as: cb(*this);
-
- If at any stage the call-back function returns false then the -grep operation terminates, otherwise continues until no further -matches are found. Returns the number of matches found. - |
-- |
- | unsigned int -Grep(std::vector<std::string>& v, const -char* p, unsigned int flags = -match_default); | -Finds all matches of the current -expression in the text p using the match flags flags -- see match flags. For each -match pushes a copy of what matched onto v. Returns the -number of matches found. | -- |
- | unsigned int -Grep(std::vector<std::string>& v, const -std::string& s, unsigned int flags = -match_default); | -Finds all matches of the current -expression in the text s using the match flags flags -- see match flags. For each -match pushes a copy of what matched onto v. Returns the -number of matches found. | -- |
- | unsigned int -Grep(std::vector<unsigned int>& v, const -char* p, unsigned int flags = -match_default); | -Finds all matches of the current -expression in the text p using the match flags flags -- see match flags. For each -match pushes the starting index of what matched onto v. -Returns the number of matches found. | -- |
- | unsigned int -Grep(std::vector<unsigned int>& v, const -std::string& s, unsigned int flags = -match_default); | -Finds all matches of the current -expression in the text s using the match flags flags -- see match flags. For each -match pushes the starting index of what matched onto v. -Returns the number of matches found. | -- |
- | unsigned int -GrepFiles(GrepFileCallback cb, const char* files, -bool recurse = false, unsigned int flags = -match_default); | -Finds all matches of the current
-expression in the files files using the match flags
-flags - see match flags. For
-each match calls the call-back function cb.
-
- If the call-back returns false then the algorithm returns -without considering further matches in the current file, or any -further files. - -The parameter files can include wild card characters '*' -and '?', if the parameter recurse is true then searches -sub-directories for matching file names. - -Returns the total number of matches found. - -May throw an exception derived from std::runtime_error if file -io fails. - |
-- |
- | unsigned int -GrepFiles(GrepFileCallback cb, const std::string& files, -bool recurse = false, unsigned int -flags = match_default); | -Finds all matches of the current
-expression in the files files using the match flags
-flags - see match flags. For
-each match calls the call-back function cb.
-
- If the call-back returns false then the algorithm returns -without considering further matches in the current file, or any -further files. - -The parameter files can include wild card characters '*' -and '?', if the parameter recurse is true then searches -sub-directories for matching file names. - -Returns the total number of matches found. - -May throw an exception derived from std::runtime_error if file -io fails. - |
-- |
- | unsigned int -FindFiles(FindFilesCallback cb, const char* files, -bool recurse = false, unsigned int -flags = match_default); | -Searches files to find all
-those which contain at least one match of the current expression
-using the match flags flags - see match flags. For each matching file
-calls the call-back function cb.
-
- If the call-back returns false then the algorithm returns -without considering any further files. - -The parameter files can include wild card characters '*' -and '?', if the parameter recurse is true then searches -sub-directories for matching file names. - -Returns the total number of files found. - -May throw an exception derived from std::runtime_error if file -io fails. - |
-- |
- | unsigned int -FindFiles(FindFilesCallback cb, const std::string& -files, bool recurse = false, unsigned -int flags = match_default); | -Searches files to find all
-those which contain at least one match of the current expression
-using the match flags flags - see match flags. For each matching file
-calls the call-back function cb.
-
- If the call-back returns false then the algorithm returns -without considering any further files. - -The parameter files can include wild card characters '*' -and '?', if the parameter recurse is true then searches -sub-directories for matching file names. - -Returns the total number of files found. - -May throw an exception derived from std::runtime_error if file -io fails. - |
-- |
- | std::string Merge(const -std::string& in, const std::string& fmt, bool -copy = true, unsigned int flags = -match_default); | -Performs a search and replace -operation: searches through the string in for all -occurrences of the current expression, for each occurrence replaces -the match with the format string fmt. Uses flags to -determine what gets matched, and how the format string should be -treated. If copy is true then all unmatched sections of -input are copied unchanged to output, if the flag -format_first_only is set then only the first occurance of the -pattern found is replaced. Returns the new string. See also format string syntax, match flags and format flags. | -- |
- | std::string Merge(const char* -in, const char* fmt, bool copy = true, -unsigned int flags = match_default); | -Performs a search and replace -operation: searches through the string in for all -occurrences of the current expression, for each occurrence replaces -the match with the format string fmt. Uses flags to -determine what gets matched, and how the format string should be -treated. If copy is true then all unmatched sections of -input are copied unchanged to output, if the flag -format_first_only is set then only the first occurance of the -pattern found is replaced. Returns the new string. See also format string syntax, match flags and format flags. | -- |
- | unsigned -Split(std::vector<std::string>& v, std::string& s, -unsigned flags = match_default, unsigned max_count = -~0); | -Splits the input string and pushes each one onto -the vector. If the expression contains no marked sub-expressions, -then one string is outputted for each section of the input that -does not match the expression. If the expression does contain -marked sub-expressions, then outputs one string for each marked -sub-expression each time a match occurs. Outputs no more than -max_count strings. Before returning, deletes from the input -string s all of the input that has been processed (all of -the string if max_count was not reached). Returns the number -of strings pushed onto the vector. | -- |
- | unsigned int -Position(int i = 0)const; | -Returns the position of what matched -sub-expression i. If i = 0 then returns the position -of the whole match. Returns RegEx::npos if the supplied index is -invalid, or if the specified sub-expression did not participate in -the match. | -- |
- | unsigned int -Length(int i = 0)const; | -Returns the length of what matched -sub-expression i. If i = 0 then returns the length of -the whole match. Returns RegEx::npos if the supplied index is -invalid, or if the specified sub-expression did not participate in -the match. | -- |
- | bool Matched(int i = -0)const; | -Returns true if sub-expression i was matched, false -otherwise. | -- |
- | unsigned int -Line()const; | -Returns the line on which the match -occurred, indexes start from 1 not zero, if no match occurred then -returns RegEx::npos. | -- |
- | unsigned int Marks() -const; | -Returns the number of marked -sub-expressions contained in the expression. Note that this -includes the whole match (sub-expression zero), so the value -returned is always >= 1. | -- |
- | std::string What(int -i)const; | -Returns a copy of what matched -sub-expression i. If i = 0 then returns a copy of the -whole match. Returns a null string if the index is invalid or if -the specified sub-expression did not participate in a match. | -- |
- | std::string -operator[](int i)const ; | -Returns what(i);
-
- Can be used to simplify access to sub-expression matches, and -make usage more perl-like. - |
-- |
Member functions for class RegEx are defined as follows:
+
+ | RegEx(); | +Default constructor, constructs an instance of RegEx + without any valid expression. | ++ |
+ | RegEx(const RegEx& o); | +Copy constructor, all the properties of parameter o + are copied. | ++ |
+ | RegEx(const char* c, bool icase + = false); | +Constructs an instance of RegEx, setting the + expression to c, if icase is true then matching is + insensitive to case, otherwise it is sensitive to case. Throws bad_expression + on failure. | ++ |
+ | RegEx(const std::string& s, bool icase + = false); | +Constructs an instance of RegEx, setting the + expression to s, if icase is true then matching is + insensitive to case, otherwise it is sensitive to case. Throws bad_expression + on failure. | ++ |
+ | RegEx& operator=(const RegEx& + o); | +Default assignment operator. | ++ |
+ | RegEx& operator=(const char* + p); | +Assignment operator, equivalent to calling SetExpression(p, + false). Throws bad_expression on failure. | ++ |
+ | RegEx& operator=(const std::string& + s); | +Assignment operator, equivalent to calling SetExpression(s, + false). Throws bad_expression on failure. | ++ |
+ | unsigned int SetExpression(constchar* + p, bool icase = false); | +Sets the current expression to p, if icase + is true then matching is insensitive to case, otherwise it is sensitive + to case. Throws bad_expression on failure. | ++ |
+ | unsigned int SetExpression(const + std::string& s, bool icase = false); | +Sets the current expression to s, if icase + is true then matching is insensitive to case, otherwise it is sensitive + to case. Throws bad_expression on failure. | ++ |
+ | std::string Expression()const; | +Returns a copy of the current regular expression. | ++ |
+ | bool Match(const char* p, + boost::match_flag_type flags = match_default); | +Attempts to match the current expression against the + text p using the match flags flags - see + match flags. Returns true if the expression matches the whole of + the input string. | ++ |
+ | bool Match(const std::string& s, + boost::match_flag_type flags = match_default) ; | +Attempts to match the current expression against the + text s using the match flags flags - see + match flags. Returns true if the expression matches the whole of + the input string. | ++ |
+ | bool Search(const char* p, + boost::match_flag_type flags = match_default); | +Attempts to find a match for the current expression + somewhere in the text p using the match flags flags - see + match flags. Returns true if the match succeeds. | ++ |
+ | bool Search(const std::string& s, + boost::match_flag_type flags = match_default) ; | +Attempts to find a match for the current expression + somewhere in the text s using the match flags flags - see + match flags. Returns true if the match succeeds. | ++ |
+ | unsigned int Grep(GrepCallback cb, const + char* p, boost::match_flag_type flags = match_default); | +Finds all matches of the current expression in the
+ text p using the match flags flags - see
+ match flags. For each match found calls the call-back function cb
+ as: cb(*this);
+ If at any stage the call-back function returns false then the grep operation + terminates, otherwise continues until no further matches are found. Returns the + number of matches found. + |
+ + |
+ | unsigned int Grep(GrepCallback cb, const + std::string& s, boost::match_flag_type flags = match_default); | +Finds all matches of the current expression in the
+ text s using the match flags flags - see
+ match flags. For each match found calls the call-back function cb
+ as: cb(*this);
+ If at any stage the call-back function returns false then the grep operation + terminates, otherwise continues until no further matches are found. Returns the + number of matches found. + |
+ + |
+ | unsigned int Grep(std::vector<std::string>& + v, const char* p, boost::match_flag_type flags = match_default); | +Finds all matches of the current expression in the + text p using the match flags flags - see + match flags. For each match pushes a copy of what matched onto v. + Returns the number of matches found. | ++ |
+ | unsigned int Grep(std::vector<std::string>& + v, const std::string& s, boost::match_flag_type flags = + match_default); | +Finds all matches of the current expression in the + text s using the match flags flags - see + match flags. For each match pushes a copy of what matched onto v. + Returns the number of matches found. | ++ |
+ | unsigned int Grep(std::vector<unsigned + int>& v, const char* p, boost::match_flag_type + flags = match_default); | +Finds all matches of the current expression in the + text p using the match flags flags - see + match flags. For each match pushes the starting index of what matched + onto v. Returns the number of matches found. | ++ |
+ | unsigned int Grep(std::vector<unsigned + int>& v, const std::string& s, boost::match_flag_type + flags = match_default); | +Finds all matches of the current expression in the + text s using the match flags flags - see + match flags. For each match pushes the starting index of what matched + onto v. Returns the number of matches found. | ++ |
+ | unsigned int GrepFiles(GrepFileCallback + cb, const char* files, bool recurse = false, + boost::match_flag_type flags = match_default); | +Finds all matches of the current expression in the
+ files files using the match flags flags - see
+ match flags. For each match calls the call-back function cb.
+ If the call-back returns false then the algorithm returns without considering + further matches in the current file, or any further files. +The parameter files can include wild card characters '*' and '?', if the + parameter recurse is true then searches sub-directories for matching + file names. +Returns the total number of matches found. +May throw an exception derived from std::runtime_error if file io fails. + |
+ + |
+ | unsigned int GrepFiles(GrepFileCallback + cb, const std::string& files, bool recurse = false, + boost::match_flag_type flags = match_default); | +Finds all matches of the current expression in the
+ files files using the match flags flags - see
+ match flags. For each match calls the call-back function cb.
+ If the call-back returns false then the algorithm returns without considering + further matches in the current file, or any further files. +The parameter files can include wild card characters '*' and '?', if the + parameter recurse is true then searches sub-directories for matching + file names. +Returns the total number of matches found. +May throw an exception derived from std::runtime_error if file io fails. + |
+ + |
+ | unsigned int FindFiles(FindFilesCallback + cb, const char* files, bool recurse = false, + boost::match_flag_type flags = match_default); | +Searches files to find all those which contain
+ at least one match of the current expression using the match flags flags
+ - see match flags. For each matching file
+ calls the call-back function cb.
+ If the call-back returns false then the algorithm returns without considering + any further files. +The parameter files can include wild card characters '*' and '?', if the + parameter recurse is true then searches sub-directories for matching + file names. +Returns the total number of files found. +May throw an exception derived from std::runtime_error if file io fails. + |
+ + |
+ | unsigned int FindFiles(FindFilesCallback + cb, const std::string& files, bool recurse = false, + boost::match_flag_type flags = match_default); | +Searches files to find all those which contain
+ at least one match of the current expression using the match flags flags
+ - see match flags. For each matching file
+ calls the call-back function cb.
+ If the call-back returns false then the algorithm returns without considering + any further files. +The parameter files can include wild card characters '*' and '?', if the + parameter recurse is true then searches sub-directories for matching + file names. +Returns the total number of files found. +May throw an exception derived from std::runtime_error if file io fails. + |
+ + |
+ | std::string Merge(const std::string& in, const + std::string& fmt, bool copy = true, boost::match_flag_type + flags = match_default); | +Performs a search and replace operation: searches + through the string in for all occurrences of the current expression, for + each occurrence replaces the match with the format string fmt. Uses flags + to determine what gets matched, and how the format string should be treated. If + copy is true then all unmatched sections of input are copied unchanged + to output, if the flag format_first_only is set then only the first + occurance of the pattern found is replaced. Returns the new string. See + also format string syntax, match flags + and format flags. | ++ |
+ | std::string Merge(const char* in, const + char* fmt, bool copy = true, boost::match_flag_type flags = + match_default); | +Performs a search and replace operation: searches + through the string in for all occurrences of the current expression, for + each occurrence replaces the match with the format string fmt. Uses flags + to determine what gets matched, and how the format string should be treated. If + copy is true then all unmatched sections of input are copied unchanged + to output, if the flag format_first_only is set then only the first + occurance of the pattern found is replaced. Returns the new string. See + also format string syntax, match flags + and format flags. | ++ |
+ | unsigned Split(std::vector<std::string>& v, + std::string& s, boost::match_flag_type flags = match_default, unsigned + max_count = ~0); | +Splits the input string and pushes each one onto the vector. If + the expression contains no marked sub-expressions, then one string is outputted + for each section of the input that does not match the expression. If the + expression does contain marked sub-expressions, then outputs one string for + each marked sub-expression each time a match occurs. Outputs no more than max_count + strings. Before returning, deletes from the input string s all of the + input that has been processed (all of the string if max_count was not + reached). Returns the number of strings pushed onto the vector. | ++ |
+ | unsigned int Position(int i = 0)const; | +Returns the position of what matched sub-expression i. + If i = 0 then returns the position of the whole match. Returns + RegEx::npos if the supplied index is invalid, or if the specified + sub-expression did not participate in the match. | ++ |
+ | unsigned int Length(int i = 0)const; | +Returns the length of what matched sub-expression i. + If i = 0 then returns the length of the whole match. Returns RegEx::npos + if the supplied index is invalid, or if the specified sub-expression did not + participate in the match. | ++ |
+ | bool Matched(int i = 0)const; | +Returns true if sub-expression i was matched, false otherwise. | ++ |
+ | unsigned int Line()const; | +Returns the line on which the match occurred, indexes + start from 1 not zero, if no match occurred then returns RegEx::npos. | ++ |
+ | unsigned int Marks() const; | +Returns the number of marked sub-expressions + contained in the expression. Note that this includes the whole match + (sub-expression zero), so the value returned is always >= 1. | ++ |
+ | std::string What(int i)const; | +Returns a copy of what matched sub-expression i. + If i = 0 then returns a copy of the whole match. Returns a null string + if the index is invalid or if the specified sub-expression did not participate + in a match. | ++ |
+ | std::string operator[](int i)const + ; | +Returns what(i);
+ Can be used to simplify access to sub-expression matches, and make usage more + perl-like. + |
+ + |
Revised - 24 Oct 2003 + 04 Feb 2004
© Copyright John Maddock 1998- - - 2003
+ 2004Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- + - - diff --git a/doc/Attic/regex_grep.html b/doc/Attic/regex_grep.html index 8902a181..e2e4c355 100644 --- a/doc/Attic/regex_grep.html +++ b/doc/Attic/regex_grep.html @@ -42,7 +42,7 @@ iterator first, iterator last, const basic_regex<charT, traits, Allocator>& e, - unsigned flags = match_default) + boost::match_flag_type flags = match_default)The library also defines the following convenience versions, which take either a const charT*, or a const std::basic_string<>& in place of a pair of @@ -53,13 +53,13 @@ unsigned int regex_grep(Predicate foo, const charT* str, const basic_regex<charT, traits, Allocator>& e, - unsigned flags = match_default); + boost::match_flag_type flags = match_default); template <class Predicate, class ST, class SA, class Allocator, class charT, class traits> unsigned int regex_grep(Predicate foo, const std::basic_string<charT, ST, SA>& s, const basic_regex<charT, traits, Allocator>& e, - unsigned flags = match_default); + boost::match_flag_type flags = match_default);
The parameters for the primary version of regex_grep have the following meanings:
@@ -370,11 +370,10 @@ index[std::string(what[5].first, what[5].second) + std::string(what[6].first, whRevised - 24 Oct 2003 + 04 Feb 2004
© Copyright John Maddock 1998- - - 2003
+ 2004Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/doc/Attic/regex_search.html b/doc/Attic/regex_search.html index 62f8eef4..f0e8f6a3 100644 --- a/doc/Attic/regex_search.html +++ b/doc/Attic/regex_search.html @@ -294,7 +294,7 @@ void IndexClasses(map_type& m, const std::string& file) start = file.begin(); end = file.end(); boost::match_results<std::string::const_iterator> what; - unsigned int flags = boost::match_default; + boost::match_flag_type flags = boost::match_default; while(regex_search(start, end, what, expression, flags)) { // what[0] contains the whole string @@ -314,11 +314,10 @@ void IndexClasses(map_type& m, const std::string& file)Revised - 24 Oct 2003 + 04 Feb 2004
© Copyright John Maddock 1998- - - 2003
+ 2004Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/doc/Attic/regex_split.html b/doc/Attic/regex_split.html index 66af2b16..3b2ed99e 100644 --- a/doc/Attic/regex_split.html +++ b/doc/Attic/regex_split.html @@ -38,15 +38,15 @@template <class OutputIterator, class charT, class Traits1, class Alloc1, class Traits2, class Alloc2> std::size_t regex_split(OutputIterator out, std::basic_string<charT, Traits1, Alloc1>& s, - const basic_regex<charT, Traits2, Alloc2>& e, - unsigned flags, + const basic_regex<charT, Traits2, Alloc2>& e, + boost::match_flag_type flags, std::size_t max_split); template <class OutputIterator, class charT, class Traits1, class Alloc1, class Traits2, class Alloc2> std::size_t regex_split(OutputIterator out, std::basic_string<charT, Traits1, Alloc1>& s, - const basic_regex<charT, Traits2, Alloc2>& e, - unsigned flags = match_default); + const basic_regex<charT, Traits2, Alloc2>& e, + boost::match_flag_type flags = match_default); template <class OutputIterator, class charT, class Traits1, class Alloc1> std::size_t regex_split(OutputIterator out, @@ -134,11 +134,10 @@ boost::regex e("<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)
Revised - 24 Oct 2003 + 04 Feb 2004
© Copyright John Maddock 1998- - - 2003
+ 2004Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/doc/match_flag_type.html b/doc/match_flag_type.html index dc9c2dbe..3d6e83d1 100644 --- a/doc/match_flag_type.html +++ b/doc/match_flag_type.html @@ -31,7 +31,7 @@ character sequence. The behavior of the format flags is descibed in more detail in the format syntax guide.-namespace std{ namespace regex_constants{ +namespace boost{ namespace regex_constants{ typedef bitmask_type match_flag_type; @@ -59,7 +59,7 @@ static const match_flag_type format_first_only; static const match_flag_type format_all; } // namespace regex_constants -} // namespace std +} // namespace boostDescription
The type
match_flag_type
is an implementation defined bitmask type @@ -271,10 +271,10 @@ static const match_flag_type format_all;
Revised - 24 Oct 2003 + 04 Feb 2004
© Copyright John Maddock 1998- - 2003
+ 2004Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/doc/regex.html b/doc/regex.html index b0701874..dcbd7ed4 100644 --- a/doc/regex.html +++ b/doc/regex.html @@ -1,56 +1,43 @@ - - -Boost.Regex: class RegEx (deprecated) - - - - - - --
- -- -- --
- -Boost.Regex
- -class RegEx (deprecated)
-- --
-
- - -
-The high level wrapper class RegEx is now deprecated and does -not form a part of the -regular expression standardization proposal. This type -still exists, and existing code will continue to compile, however -the following documentation is unlikely to be further updated.
- -+ +Boost.Regex: class RegEx (deprecated) + + + + + + ++
++ ++ ++
+ +Boost.Regex
+class RegEx (deprecated)
++ ++
+
+
+The high level wrapper class RegEx is now deprecated and does not form a part + of the regular + expression standardization proposal. This type still exists, and + existing code will continue to compile, however the following documentation is + unlikely to be further updated.
+#include <boost/cregex.hpp>- -The class RegEx provides a high level simplified interface to -the regular expression library, this class only handles narrow -character strings, and regular expressions always follow the -"normal" syntax - that is the same as the perl / ECMAScript -synatx.
- -+The class RegEx provides a high level simplified interface to the regular + expression library, this class only handles narrow character strings, and + regular expressions always follow the "normal" syntax - that is the same as the + perl / ECMAScript synatx.
+typedef bool (*GrepCallback)(const RegEx& expression); typedef bool (*GrepFileCallback)(const char* file, const RegEx& expression); typedef bool (*FindFilesCallback)(const char* file); @@ -72,23 +59,23 @@ synatx. // // now matching operators: // - bool Match(const char* p, unsigned int flags = match_default); - bool Match(const std::string& s, unsigned int flags = match_default); - bool Search(const char* p, unsigned int flags = match_default); - bool Search(const std::string& s, unsigned int flags = match_default); - unsigned int Grep(GrepCallback cb, const char* p, unsigned int flags = match_default); - unsigned int Grep(GrepCallback cb, const std::string& s, unsigned int flags = match_default); - unsigned int Grep(std::vector<std::string>& v, const char* p, unsigned int flags = match_default); - unsigned int Grep(std::vector<std::string>& v, const std::string& s, unsigned int flags = match_default); - unsigned int Grep(std::vector<unsigned int>& v, const char* p, unsigned int flags = match_default); - unsigned int Grep(std::vector<unsigned int>& v, const std::string& s, unsigned int flags = match_default); - unsigned int GrepFiles(GrepFileCallback cb, const char* files, bool recurse = false, unsigned int flags = match_default); - unsigned int GrepFiles(GrepFileCallback cb, const std::string& files, bool recurse = false, unsigned int flags = match_default); - unsigned int FindFiles(FindFilesCallback cb, const char* files, bool recurse = false, unsigned int flags = match_default); - unsigned int FindFiles(FindFilesCallback cb, const std::string& files, bool recurse = false, unsigned int flags = match_default); - std::string Merge(const std::string& in, const std::string& fmt, bool copy = true, unsigned int flags = match_default); - std::string Merge(const char* in, const char* fmt, bool copy = true, unsigned int flags = match_default); - unsigned Split(std::vector<std::string>& v, std::string& s, unsigned flags = match_default, unsigned max_count = ~0); + bool Match(const char* p, boost::match_flag_type flags = match_default); + bool Match(const std::string& s, boost::match_flag_type flags = match_default); + bool Search(const char* p, boost::match_flag_type flags = match_default); + bool Search(const std::string& s, boost::match_flag_type flags = match_default); + unsigned int Grep(GrepCallback cb, const char* p, boost::match_flag_type flags = match_default); + unsigned int Grep(GrepCallback cb, const std::string& s, boost::match_flag_type flags = match_default); + unsigned int Grep(std::vector<std::string>& v, const char* p, boost::match_flag_type flags = match_default); + unsigned int Grep(std::vector<std::string>& v, const std::string& s, boost::match_flag_type flags = match_default); + unsigned int Grep(std::vector<unsigned int>& v, const char* p, boost::match_flag_type flags = match_default); + unsigned int Grep(std::vector<unsigned int>& v, const std::string& s, boost::match_flag_type flags = match_default); + unsigned int GrepFiles(GrepFileCallback cb, const char* files, bool recurse = false, boost::match_flag_type flags = match_default); + unsigned int GrepFiles(GrepFileCallback cb, const std::string& files, bool recurse = false, boost::match_flag_type flags = match_default); + unsigned int FindFiles(FindFilesCallback cb, const char* files, bool recurse = false, boost::match_flag_type flags = match_default); + unsigned int FindFiles(FindFilesCallback cb, const std::string& files, bool recurse = false, boost::match_flag_type flags = match_default); + std::string Merge(const std::string& in, const std::string& fmt, bool copy = true, boost::match_flag_type flags = match_default); + std::string Merge(const char* in, const char* fmt, bool copy = true, boost::match_flag_type flags = match_default); + unsigned Split(std::vector<std::string>& v, std::string& s, boost::match_flag_type flags = match_default, unsigned max_count = ~0); // // now operators for returning what matched in more detail: // @@ -103,509 +90,392 @@ synatx. static const unsigned int npos; };- -Member functions for class RegEx are defined as follows:
- - - -
--
- -- - -- RegEx(); -Default constructor, constructs an -instance of RegEx without any valid expression. -- - - -- RegEx(const RegEx& o); -Copy constructor, all the properties -of parameter o are copied. -- - - -- RegEx(const char* c, -bool icase = false); -Constructs an instance of RegEx, -setting the expression to c, if icase is true -then matching is insensitive to case, otherwise it is sensitive to -case. Throws bad_expression on failure. -- - - -- RegEx(const std::string& s, -bool icase = false); -Constructs an instance of RegEx, -setting the expression to s, if icase is true -then matching is insensitive to case, otherwise it is sensitive to -case. Throws bad_expression on failure. -- - - -- RegEx& -operator=(const RegEx& o); -Default assignment operator. -- - - -- RegEx& -operator=(const char* p); -Assignment operator, equivalent to -calling SetExpression(p, false). Throws -bad_expression on failure. -- - - -- RegEx& -operator=(const std::string& s); -Assignment operator, equivalent to -calling SetExpression(s, false). Throws -bad_expression on failure. -- - - -- unsigned int -SetExpression(constchar* p, bool icase = -false); -Sets the current expression to -p, if icase is true then matching is insensitive -to case, otherwise it is sensitive to case. Throws -bad_expression on failure. -- - - -- unsigned int -SetExpression(const std::string& s, bool icase = -false); -Sets the current expression to -s, if icase is true then matching is insensitive -to case, otherwise it is sensitive to case. Throws -bad_expression on failure. -- - - -- std::string -Expression()const; -Returns a copy of the current regular -expression. -- - - -- bool Match(const -char* p, unsigned int flags = -match_default); -Attempts to match the current -expression against the text p using the match flags -flags - see match flags. -Returns true if the expression matches the whole of the -input string. -- - - -- bool Match(const -std::string& s, unsigned int flags = -match_default) ; -Attempts to match the current -expression against the text s using the match flags -flags - see match flags. -Returns true if the expression matches the whole of the -input string. -- - - -- bool Search(const -char* p, unsigned int flags = -match_default); -Attempts to find a match for the -current expression somewhere in the text p using the match -flags flags - see match -flags. Returns true if the match succeeds. -- - - -- bool Search(const -std::string& s, unsigned int flags = -match_default) ; -Attempts to find a match for the -current expression somewhere in the text s using the match -flags flags - see match -flags. Returns true if the match succeeds. -- - - -- unsigned int -Grep(GrepCallback cb, const char* p, unsigned -int flags = match_default); -Finds all matches of the current -expression in the text p using the match flags flags -- see match flags. For each -match found calls the call-back function cb as: cb(*this); - - -If at any stage the call-back function returns false then the -grep operation terminates, otherwise continues until no further -matches are found. Returns the number of matches found.
-- - - -- unsigned int -Grep(GrepCallback cb, const std::string& s, -unsigned int flags = match_default); -Finds all matches of the current -expression in the text s using the match flags flags -- see match flags. For each -match found calls the call-back function cb as: cb(*this); - - -If at any stage the call-back function returns false then the -grep operation terminates, otherwise continues until no further -matches are found. Returns the number of matches found.
-- - - -- unsigned int -Grep(std::vector<std::string>& v, const -char* p, unsigned int flags = -match_default); -Finds all matches of the current -expression in the text p using the match flags flags -- see match flags. For each -match pushes a copy of what matched onto v. Returns the -number of matches found. -- - - -- unsigned int -Grep(std::vector<std::string>& v, const -std::string& s, unsigned int flags = -match_default); -Finds all matches of the current -expression in the text s using the match flags flags -- see match flags. For each -match pushes a copy of what matched onto v. Returns the -number of matches found. -- - - -- unsigned int -Grep(std::vector<unsigned int>& v, const -char* p, unsigned int flags = -match_default); -Finds all matches of the current -expression in the text p using the match flags flags -- see match flags. For each -match pushes the starting index of what matched onto v. -Returns the number of matches found. -- - - -- unsigned int -Grep(std::vector<unsigned int>& v, const -std::string& s, unsigned int flags = -match_default); -Finds all matches of the current -expression in the text s using the match flags flags -- see match flags. For each -match pushes the starting index of what matched onto v. -Returns the number of matches found. -- - - -- unsigned int -GrepFiles(GrepFileCallback cb, const char* files, -bool recurse = false, unsigned int flags = -match_default); -Finds all matches of the current -expression in the files files using the match flags -flags - see match flags. For -each match calls the call-back function cb. - - -If the call-back returns false then the algorithm returns -without considering further matches in the current file, or any -further files.
- -The parameter files can include wild card characters '*' -and '?', if the parameter recurse is true then searches -sub-directories for matching file names.
- -Returns the total number of matches found.
- -May throw an exception derived from std::runtime_error if file -io fails.
-- - - -- unsigned int -GrepFiles(GrepFileCallback cb, const std::string& files, -bool recurse = false, unsigned int -flags = match_default); -Finds all matches of the current -expression in the files files using the match flags -flags - see match flags. For -each match calls the call-back function cb. - - -If the call-back returns false then the algorithm returns -without considering further matches in the current file, or any -further files.
- -The parameter files can include wild card characters '*' -and '?', if the parameter recurse is true then searches -sub-directories for matching file names.
- -Returns the total number of matches found.
- -May throw an exception derived from std::runtime_error if file -io fails.
-- - - -- unsigned int -FindFiles(FindFilesCallback cb, const char* files, -bool recurse = false, unsigned int -flags = match_default); -Searches files to find all -those which contain at least one match of the current expression -using the match flags flags - see match flags. For each matching file -calls the call-back function cb. - - -If the call-back returns false then the algorithm returns -without considering any further files.
- -The parameter files can include wild card characters '*' -and '?', if the parameter recurse is true then searches -sub-directories for matching file names.
- -Returns the total number of files found.
- -May throw an exception derived from std::runtime_error if file -io fails.
-- - - -- unsigned int -FindFiles(FindFilesCallback cb, const std::string& -files, bool recurse = false, unsigned -int flags = match_default); -Searches files to find all -those which contain at least one match of the current expression -using the match flags flags - see match flags. For each matching file -calls the call-back function cb. - - -If the call-back returns false then the algorithm returns -without considering any further files.
- -The parameter files can include wild card characters '*' -and '?', if the parameter recurse is true then searches -sub-directories for matching file names.
- -Returns the total number of files found.
- -May throw an exception derived from std::runtime_error if file -io fails.
-- - - -- std::string Merge(const -std::string& in, const std::string& fmt, bool -copy = true, unsigned int flags = -match_default); -Performs a search and replace -operation: searches through the string in for all -occurrences of the current expression, for each occurrence replaces -the match with the format string fmt. Uses flags to -determine what gets matched, and how the format string should be -treated. If copy is true then all unmatched sections of -input are copied unchanged to output, if the flag -format_first_only is set then only the first occurance of the -pattern found is replaced. Returns the new string. See also format string syntax, match flags and format flags. -- - - -- std::string Merge(const char* -in, const char* fmt, bool copy = true, -unsigned int flags = match_default); -Performs a search and replace -operation: searches through the string in for all -occurrences of the current expression, for each occurrence replaces -the match with the format string fmt. Uses flags to -determine what gets matched, and how the format string should be -treated. If copy is true then all unmatched sections of -input are copied unchanged to output, if the flag -format_first_only is set then only the first occurance of the -pattern found is replaced. Returns the new string. See also format string syntax, match flags and format flags. -- - - -- unsigned -Split(std::vector<std::string>& v, std::string& s, -unsigned flags = match_default, unsigned max_count = -~0); -Splits the input string and pushes each one onto -the vector. If the expression contains no marked sub-expressions, -then one string is outputted for each section of the input that -does not match the expression. If the expression does contain -marked sub-expressions, then outputs one string for each marked -sub-expression each time a match occurs. Outputs no more than -max_count strings. Before returning, deletes from the input -string s all of the input that has been processed (all of -the string if max_count was not reached). Returns the number -of strings pushed onto the vector. -- - - -- unsigned int -Position(int i = 0)const; -Returns the position of what matched -sub-expression i. If i = 0 then returns the position -of the whole match. Returns RegEx::npos if the supplied index is -invalid, or if the specified sub-expression did not participate in -the match. -- - - -- unsigned int -Length(int i = 0)const; -Returns the length of what matched -sub-expression i. If i = 0 then returns the length of -the whole match. Returns RegEx::npos if the supplied index is -invalid, or if the specified sub-expression did not participate in -the match. -- - - -- bool Matched(int i = -0)const; -Returns true if sub-expression i was matched, false -otherwise. -- - - -- unsigned int -Line()const; -Returns the line on which the match -occurred, indexes start from 1 not zero, if no match occurred then -returns RegEx::npos. -- - - -- unsigned int Marks() -const; -Returns the number of marked -sub-expressions contained in the expression. Note that this -includes the whole match (sub-expression zero), so the value -returned is always >= 1. -- - - -- std::string What(int -i)const; -Returns a copy of what matched -sub-expression i. If i = 0 then returns a copy of the -whole match. Returns a null string if the index is invalid or if -the specified sub-expression did not participate in a match. -- - -- std::string -operator[](int i)const ; -Returns what(i); - - -Can be used to simplify access to sub-expression matches, and -make usage more perl-like.
--
-
- - - - -
+Member functions for class RegEx are defined as follows:
+ +
++
++ ++ RegEx(); +Default constructor, constructs an instance of RegEx + without any valid expression. ++ + ++ RegEx(const RegEx& o); +Copy constructor, all the properties of parameter o + are copied. ++ + ++ RegEx(const char* c, bool icase + = false); +Constructs an instance of RegEx, setting the + expression to c, if icase is true then matching is + insensitive to case, otherwise it is sensitive to case. Throws bad_expression + on failure. ++ + ++ RegEx(const std::string& s, bool icase + = false); +Constructs an instance of RegEx, setting the + expression to s, if icase is true then matching is + insensitive to case, otherwise it is sensitive to case. Throws bad_expression + on failure. ++ + ++ RegEx& operator=(const RegEx& + o); +Default assignment operator. ++ + ++ RegEx& operator=(const char* + p); +Assignment operator, equivalent to calling SetExpression(p, + false). Throws bad_expression on failure. ++ + ++ RegEx& operator=(const std::string& + s); +Assignment operator, equivalent to calling SetExpression(s, + false). Throws bad_expression on failure. ++ + ++ unsigned int SetExpression(constchar* + p, bool icase = false); +Sets the current expression to p, if icase + is true then matching is insensitive to case, otherwise it is sensitive + to case. Throws bad_expression on failure. ++ + ++ unsigned int SetExpression(const + std::string& s, bool icase = false); +Sets the current expression to s, if icase + is true then matching is insensitive to case, otherwise it is sensitive + to case. Throws bad_expression on failure. ++ + ++ std::string Expression()const; +Returns a copy of the current regular expression. ++ + ++ bool Match(const char* p, + boost::match_flag_type flags = match_default); +Attempts to match the current expression against the + text p using the match flags flags - see + match flags. Returns true if the expression matches the whole of + the input string. ++ + ++ bool Match(const std::string& s, + boost::match_flag_type flags = match_default) ; +Attempts to match the current expression against the + text s using the match flags flags - see + match flags. Returns true if the expression matches the whole of + the input string. ++ + ++ bool Search(const char* p, + boost::match_flag_type flags = match_default); +Attempts to find a match for the current expression + somewhere in the text p using the match flags flags - see + match flags. Returns true if the match succeeds. ++ + ++ bool Search(const std::string& s, + boost::match_flag_type flags = match_default) ; +Attempts to find a match for the current expression + somewhere in the text s using the match flags flags - see + match flags. Returns true if the match succeeds. ++ + ++ unsigned int Grep(GrepCallback cb, const + char* p, boost::match_flag_type flags = match_default); +Finds all matches of the current expression in the + text p using the match flags flags - see + match flags. For each match found calls the call-back function cb + as: cb(*this); + +If at any stage the call-back function returns false then the grep operation + terminates, otherwise continues until no further matches are found. Returns the + number of matches found.
++ + ++ unsigned int Grep(GrepCallback cb, const + std::string& s, boost::match_flag_type flags = match_default); +Finds all matches of the current expression in the + text s using the match flags flags - see + match flags. For each match found calls the call-back function cb + as: cb(*this); + +If at any stage the call-back function returns false then the grep operation + terminates, otherwise continues until no further matches are found. Returns the + number of matches found.
++ + ++ unsigned int Grep(std::vector<std::string>& + v, const char* p, boost::match_flag_type flags = match_default); +Finds all matches of the current expression in the + text p using the match flags flags - see + match flags. For each match pushes a copy of what matched onto v. + Returns the number of matches found. ++ + ++ unsigned int Grep(std::vector<std::string>& + v, const std::string& s, boost::match_flag_type flags = + match_default); +Finds all matches of the current expression in the + text s using the match flags flags - see + match flags. For each match pushes a copy of what matched onto v. + Returns the number of matches found. ++ + ++ unsigned int Grep(std::vector<unsigned + int>& v, const char* p, boost::match_flag_type + flags = match_default); +Finds all matches of the current expression in the + text p using the match flags flags - see + match flags. For each match pushes the starting index of what matched + onto v. Returns the number of matches found. ++ + ++ unsigned int Grep(std::vector<unsigned + int>& v, const std::string& s, boost::match_flag_type + flags = match_default); +Finds all matches of the current expression in the + text s using the match flags flags - see + match flags. For each match pushes the starting index of what matched + onto v. Returns the number of matches found. ++ + ++ unsigned int GrepFiles(GrepFileCallback + cb, const char* files, bool recurse = false, + boost::match_flag_type flags = match_default); +Finds all matches of the current expression in the + files files using the match flags flags - see + match flags. For each match calls the call-back function cb. + +If the call-back returns false then the algorithm returns without considering + further matches in the current file, or any further files.
+The parameter files can include wild card characters '*' and '?', if the + parameter recurse is true then searches sub-directories for matching + file names.
+Returns the total number of matches found.
+May throw an exception derived from std::runtime_error if file io fails.
++ + ++ unsigned int GrepFiles(GrepFileCallback + cb, const std::string& files, bool recurse = false, + boost::match_flag_type flags = match_default); +Finds all matches of the current expression in the + files files using the match flags flags - see + match flags. For each match calls the call-back function cb. + +If the call-back returns false then the algorithm returns without considering + further matches in the current file, or any further files.
+The parameter files can include wild card characters '*' and '?', if the + parameter recurse is true then searches sub-directories for matching + file names.
+Returns the total number of matches found.
+May throw an exception derived from std::runtime_error if file io fails.
++ + ++ unsigned int FindFiles(FindFilesCallback + cb, const char* files, bool recurse = false, + boost::match_flag_type flags = match_default); +Searches files to find all those which contain + at least one match of the current expression using the match flags flags + - see match flags. For each matching file + calls the call-back function cb. + +If the call-back returns false then the algorithm returns without considering + any further files.
+The parameter files can include wild card characters '*' and '?', if the + parameter recurse is true then searches sub-directories for matching + file names.
+Returns the total number of files found.
+May throw an exception derived from std::runtime_error if file io fails.
++ + ++ unsigned int FindFiles(FindFilesCallback + cb, const std::string& files, bool recurse = false, + boost::match_flag_type flags = match_default); +Searches files to find all those which contain + at least one match of the current expression using the match flags flags + - see match flags. For each matching file + calls the call-back function cb. + +If the call-back returns false then the algorithm returns without considering + any further files.
+The parameter files can include wild card characters '*' and '?', if the + parameter recurse is true then searches sub-directories for matching + file names.
+Returns the total number of files found.
+May throw an exception derived from std::runtime_error if file io fails.
++ + ++ std::string Merge(const std::string& in, const + std::string& fmt, bool copy = true, boost::match_flag_type + flags = match_default); +Performs a search and replace operation: searches + through the string in for all occurrences of the current expression, for + each occurrence replaces the match with the format string fmt. Uses flags + to determine what gets matched, and how the format string should be treated. If + copy is true then all unmatched sections of input are copied unchanged + to output, if the flag format_first_only is set then only the first + occurance of the pattern found is replaced. Returns the new string. See + also format string syntax, match flags + and format flags. ++ + ++ std::string Merge(const char* in, const + char* fmt, bool copy = true, boost::match_flag_type flags = + match_default); +Performs a search and replace operation: searches + through the string in for all occurrences of the current expression, for + each occurrence replaces the match with the format string fmt. Uses flags + to determine what gets matched, and how the format string should be treated. If + copy is true then all unmatched sections of input are copied unchanged + to output, if the flag format_first_only is set then only the first + occurance of the pattern found is replaced. Returns the new string. See + also format string syntax, match flags + and format flags. ++ + ++ unsigned Split(std::vector<std::string>& v, + std::string& s, boost::match_flag_type flags = match_default, unsigned + max_count = ~0); +Splits the input string and pushes each one onto the vector. If + the expression contains no marked sub-expressions, then one string is outputted + for each section of the input that does not match the expression. If the + expression does contain marked sub-expressions, then outputs one string for + each marked sub-expression each time a match occurs. Outputs no more than max_count + strings. Before returning, deletes from the input string s all of the + input that has been processed (all of the string if max_count was not + reached). Returns the number of strings pushed onto the vector. ++ + ++ unsigned int Position(int i = 0)const; +Returns the position of what matched sub-expression i. + If i = 0 then returns the position of the whole match. Returns + RegEx::npos if the supplied index is invalid, or if the specified + sub-expression did not participate in the match. ++ + ++ unsigned int Length(int i = 0)const; +Returns the length of what matched sub-expression i. + If i = 0 then returns the length of the whole match. Returns RegEx::npos + if the supplied index is invalid, or if the specified sub-expression did not + participate in the match. ++ + ++ bool Matched(int i = 0)const; +Returns true if sub-expression i was matched, false otherwise. ++ + ++ unsigned int Line()const; +Returns the line on which the match occurred, indexes + start from 1 not zero, if no match occurred then returns RegEx::npos. ++ + ++ unsigned int Marks() const; +Returns the number of marked sub-expressions + contained in the expression. Note that this includes the whole match + (sub-expression zero), so the value returned is always >= 1. ++ + ++ std::string What(int i)const; +Returns a copy of what matched sub-expression i. + If i = 0 then returns a copy of the whole match. Returns a null string + if the index is invalid or if the specified sub-expression did not participate + in a match. ++ + ++ std::string operator[](int i)const + ; +Returns what(i); + +Can be used to simplify access to sub-expression matches, and make usage more + perl-like.
++
+
+ +
Revised - 24 Oct 2003 + 04 Feb 2004
© Copyright John Maddock 1998- - - 2003
+ 2004Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- + - - diff --git a/doc/regex_grep.html b/doc/regex_grep.html index 8902a181..e2e4c355 100644 --- a/doc/regex_grep.html +++ b/doc/regex_grep.html @@ -42,7 +42,7 @@ iterator first, iterator last, const basic_regex<charT, traits, Allocator>& e, - unsigned flags = match_default) + boost::match_flag_type flags = match_default)
The library also defines the following convenience versions, which take either a const charT*, or a const std::basic_string<>& in place of a pair of @@ -53,13 +53,13 @@ unsigned int regex_grep(Predicate foo, const charT* str, const basic_regex<charT, traits, Allocator>& e, - unsigned flags = match_default); + boost::match_flag_type flags = match_default); template <class Predicate, class ST, class SA, class Allocator, class charT, class traits> unsigned int regex_grep(Predicate foo, const std::basic_string<charT, ST, SA>& s, const basic_regex<charT, traits, Allocator>& e, - unsigned flags = match_default); + boost::match_flag_type flags = match_default);
The parameters for the primary version of regex_grep have the following meanings:
@@ -370,11 +370,10 @@ index[std::string(what[5].first, what[5].second) + std::string(what[6].first, whRevised - 24 Oct 2003 + 04 Feb 2004
© Copyright John Maddock 1998- - - 2003
+ 2004Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/doc/regex_search.html b/doc/regex_search.html index 62f8eef4..f0e8f6a3 100644 --- a/doc/regex_search.html +++ b/doc/regex_search.html @@ -294,7 +294,7 @@ void IndexClasses(map_type& m, const std::string& file) start = file.begin(); end = file.end(); boost::match_results<std::string::const_iterator> what; - unsigned int flags = boost::match_default; + boost::match_flag_type flags = boost::match_default; while(regex_search(start, end, what, expression, flags)) { // what[0] contains the whole string @@ -314,11 +314,10 @@ void IndexClasses(map_type& m, const std::string& file)Revised - 24 Oct 2003 + 04 Feb 2004
© Copyright John Maddock 1998- - - 2003
+ 2004Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
diff --git a/doc/regex_split.html b/doc/regex_split.html index 66af2b16..3b2ed99e 100644 --- a/doc/regex_split.html +++ b/doc/regex_split.html @@ -38,15 +38,15 @@template <class OutputIterator, class charT, class Traits1, class Alloc1, class Traits2, class Alloc2> std::size_t regex_split(OutputIterator out, std::basic_string<charT, Traits1, Alloc1>& s, - const basic_regex<charT, Traits2, Alloc2>& e, - unsigned flags, + const basic_regex<charT, Traits2, Alloc2>& e, + boost::match_flag_type flags, std::size_t max_split); template <class OutputIterator, class charT, class Traits1, class Alloc1, class Traits2, class Alloc2> std::size_t regex_split(OutputIterator out, std::basic_string<charT, Traits1, Alloc1>& s, - const basic_regex<charT, Traits2, Alloc2>& e, - unsigned flags = match_default); + const basic_regex<charT, Traits2, Alloc2>& e, + boost::match_flag_type flags = match_default); template <class OutputIterator, class charT, class Traits1, class Alloc1> std::size_t regex_split(OutputIterator out, @@ -134,11 +134,10 @@ boost::regex e("<\\s*A\\s+[^>]*href\\s*=\\s*\"([^\"]*)
Revised - 24 Oct 2003 + 04 Feb 2004
© Copyright John Maddock 1998- - - 2003
+ 2004Use, modification and distribution are subject to the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)