From 460d2a97a907f4897eca92b68ec26641c053f9f7 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Thu, 15 May 2003 11:43:13 +0000 Subject: [PATCH] Final tweaks, almost ready for release... [SVN r18400] --- doc/Attic/bad_expression.html | 106 +- doc/Attic/basic_regex.html | 1585 ++++++++++++------------ doc/Attic/configuration.html | 402 +++--- doc/Attic/contacts.html | 191 +-- doc/Attic/examples.html | 90 +- doc/Attic/format_syntax.html | 6 +- doc/Attic/history.html | 17 +- doc/Attic/install.html | 4 +- doc/Attic/introduction.html | 19 +- doc/Attic/localisation.html | 51 +- doc/Attic/match_results.html | 48 +- doc/Attic/partial_matches.html | 6 +- doc/Attic/posix_api.html | 5 +- doc/Attic/regex_format.html | 13 +- doc/Attic/regex_grep.html | 14 +- doc/Attic/regex_iterator.html | 18 +- doc/bad_expression.html | 106 +- doc/basic_regex.html | 1585 ++++++++++++------------ doc/configuration.html | 402 +++--- doc/contacts.html | 191 +-- doc/examples.html | 90 +- doc/format_syntax.html | 6 +- doc/history.html | 17 +- doc/install.html | 4 +- doc/introduction.html | 19 +- doc/localisation.html | 51 +- doc/match_results.html | 48 +- doc/partial_matches.html | 6 +- doc/posix_api.html | 5 +- doc/regex_format.html | 13 +- doc/regex_grep.html | 14 +- doc/regex_iterator.html | 18 +- example/Jamfile | 4 +- performance/command_line.cpp | 146 ++- performance/input.html | 12 +- src/cpp_regex_traits.cpp | 3 +- test/Jamfile | 12 + test/pathology/bad_expression_test.cpp | 4 +- 38 files changed, 2875 insertions(+), 2456 deletions(-) diff --git a/doc/Attic/bad_expression.html b/doc/Attic/bad_expression.html index cf840f34..8dd0c0b7 100644 --- a/doc/Attic/bad_expression.html +++ b/doc/Attic/bad_expression.html @@ -2,76 +2,80 @@ Boost.Regex: bad_expression + -

- - - - - - -
-

C++ Boost

-
-

Boost.Regex

-

class bad_expression

-
-

Boost.Regex Index

-
-

-

-

Synopsis

-

#include <boost/pat_except.hpp> -

-

The class bad_expression defines the type of objects thrown as + + + + + + +
+

C++ Boost

+
+

Boost.Regex

+

class bad_expression

+
+

Boost.Regex Index

+
+
+
+


+

Synopsis

+

#include <boost/pattern_except.hpp>

+

The class bad_expression defines the type of objects thrown as exceptions to report errors during the conversion from a string representing a - regular expression to a finite state machine.  

-
namespace boost{
+         regular expression to a finite state machine.  

+
+namespace boost{
 
-class bad_pattern : public std::runtime_error
+class bad_pattern : public std::runtime_error
 {
-public:
-   explicit bad_pattern(const std::string& s) : std::runtime_error(s){};
+public:
+   explicit bad_pattern(const std::string& s) : std::runtime_error(s){};
 };
 
-class bad_expression : public bad_pattern
+class bad_expression : public bad_pattern
 {
-public:
-   bad_expression(const std::string& s) : bad_pattern(s) {}
+public:
+   bad_expression(const std::string& s) : bad_pattern(s) {}
 };
 
 
-} // namespace boost
-

Description

-
bad_expression(const string& what_arg); 
-

Effects: Constructs an object of class bad_expression.

- -

- Postcondition: strcmp(what(), what_arg.c_str()) == 0. -

Footnotes: the class bad_pattern forms the base class for all - pattern-matching exceptions, of which bad_expression is one. The choice - of std::runtime_error as the base class for bad_pattern - is moot, depending upon how the library is used exceptions may be either logic - errors (programmer supplied expressions) or run time errors (user supplied - expressions). -

-


-

+} // namespace boost +
+

Description

+
+bad_expression(const string& what_arg);
+
+

Effects: Constructs an object of class bad_expression.

+ +

Postcondition: strcmp(what(), what_arg.c_str()) == 0.

+

Footnotes: the class bad_pattern forms the base class for all + pattern-matching exceptions, of which bad_expression is one. The choice + of std::runtime_error as the base class for bad_pattern is moot; + depending upon how the library is used exceptions may be either logic errors + (programmer supplied expressions) or run time errors (user supplied + expressions).

+

+

Revised - + 11 April 2003 - -

-

© Copyright John Maddock 1998- 2003

-

Permission to use, copy, modify, distribute and sell this software +

+

© Copyright John Maddock 1998- + + 2003 +

+

Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Dr John Maddock makes no representations about the suitability of this software - for any purpose. It is provided "as is" without express or implied warranty.

+ for any purpose. It is provided "as is" without express or implied warranty.

diff --git a/doc/Attic/basic_regex.html b/doc/Attic/basic_regex.html index 0a7a2775..bca08197 100644 --- a/doc/Attic/basic_regex.html +++ b/doc/Attic/basic_regex.html @@ -2,57 +2,57 @@ Boost.Regex: basic_regex + -

- - - - - - -
-

C++ Boost

-
-

Boost.Regex

-

basic_regex

-
-

Boost.Regex Index

-
-

-

-

Synopsis

-
#include <boost/regex.hpp> 
-

The template class basic_regex encapsulates regular expression parsing - and compilation. The class takes three template parameters: -

-

charT: determines the character type, i.e. either char or - wchar_t. -

-

traits: determines the behaviour of the character type, for + + + + + + +
+

C++ Boost

+
+

Boost.Regex

+

basic_regex

+
+

Boost.Regex Index

+
+
+
+


+

Synopsis

+
+#include <boost/regex.hpp>
+
+

The template class basic_regex encapsulates regular expression parsing + and compilation. The class takes three template parameters:

+

charT: determines the character type, i.e. either char or + wchar_t.

+

traits: determines the behavior of the character type, for example which character class names are recognized. A default traits class is - provided: regex_traits<charT>. -

-

Allocator: the allocator class used to allocate memory by the - class. -

-

For ease of use there are two typedefs that define the two standard basic_regex + provided: regex_traits<charT>.

+

Allocator: the allocator class used to allocate memory by the + class.

+

For ease of use there are two typedefs that define the two standard basic_regex instances, unless you want to use custom traits classes or allocators, you - won't need to use anything other than these: -

-
namespace boost{
-template <class charT, class traits = regex_traits<charT>, class Allocator = std::allocator<charT>  >
-class reg_expression;
-typedef reg_expression<char> regex;
-typedef reg_expression<wchar_t> wregex;
-}
-

The definition of reg_expression follows: it is based very closely on - class basic_string, and fulfils the requirements for a constant-container of charT. -

-
namespace boost{
+         won't need to use anything other than these:

+
+namespace boost{
+template <class charT, class traits = regex_traits<charT>, class Allocator = std::allocator<charT>  >
+class basic_regex;
+typedef basic_regex<char> regex;
+typedef basic_regex<wchar_t> wregex;
+}
+
+

The definition of basic_regex follows: it is based very closely on class + basic_string, and fulfils the requirements for a constant-container of charT.

+
+namespace boost{
 
 template <class charT,
           class traits = regex_traits<charT>,
@@ -180,12 +180,13 @@ void swap(basic_regex<charT, traits, Allocator>& e1,
 typedef basic_regex<char> regex;
 typedef basic_regex<wchar_t> wregex;
 
-} // namespace boost
-

Description

-

Class basic_regex has the following public member functions: -

-

basic_regex constants

-
static const regex_constants::syntax_option_type normal = regex_constants::normal;
+} // namespace boost
+
+

Description

+

Class basic_regex has the following public member functions:

+

basic_regex constants

+
+static const regex_constants::syntax_option_type normal = regex_constants::normal;
 static const regex_constants::syntax_option_type icase = regex_constants::icase;
 static const regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
 static const regex_constants::syntax_option_type optimize = regex_constants::optimize;
@@ -199,746 +200,790 @@ static const regex_constants::syntax_option_type awk = regex_constants::awk;
 static const regex_constants::syntax_option_type grep = regex_constants::grep;
 static const regex_constants::syntax_option_type egrep = regex_constants::egrep;
 static const regex_constants::syntax_option_type sed = basic = regex_constants::sed;
-static const regex_constants::syntax_option_type perl = regex_constants::perl;
-

The static constant members are provided as synonyms for the constants declared - in namespace boost::regex_constants; for each constant of type syntax_option_type - declared in namespace boost::regex_constants then a constant with - the same name, type and value is declared within the scope of basic_regex.

-

basic_regex constructors

-

In all basic_regex constructors, a copy of the Allocator +static const regex_constants::syntax_option_type perl = regex_constants::perl; +

+

The static constant members are provided as synonyms for the constants declared + in namespace boost::regex_constants; for each constant of type syntax_option_type + declared in namespace boost::regex_constants then a constant with + the same name, type and value is declared within the scope of basic_regex.

+

basic_regex constructors

+

In all basic_regex constructors, a copy of the Allocator argument is used for any memory allocation performed by the constructor or - member functions during the lifetime of the object. -

-
basic_regex(const Allocator& a = Allocator());
- -

- Effects: Constructs an object of class basic_regex. The - postconditions of this function are indicated in the table:

-

-

-

-
-

-

- - - - - - - - - - - - - - - - - - -
-

- Element -

-
-

- Value

-

empty()

-
-

true

-
-

size()

-
-

0

-
-

str()

-
-

basic_string<charT>()

-

-
-

-
basic_regex(const charT* p, flag_type f = regex_constants::normal, const Allocator& a = Allocator());
- -

- Requires: p shall not be a null pointer.

-

- Throws: bad_expression if p is not a valid regular - expression.

-

- Effects: Constructs an object of class basic_regex; the - object's internal finite state machine is constructed from the regular - expression contained in the null-terminated string p, and interpreted - according to the option flags specified - in f. The postconditions of this function are indicated in the - table:

-

-

-

-
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Element -

-
-

- Value

-

empty()

-
-

false

-
-

size()

-
-

char_traits<charT>::length(p)

-
-

str()

-
-

basic_string<charT>(p)

-
-

getflags()

-
-

f

-
-

mark_count()

-
-

The number of marked sub-expressions within the expression.

-

-
-

-
basic_regex(const charT* p1, const charT* p2, flag_type f = regex_constants::normal, const Allocator& a = Allocator());
- -

- Requires: p1 and p2 are not null pointers, p1 < p2.

-

- Throws: bad_expression if [p1,p2) is not a valid regular - expression.

-

- Effects: Constructs an object of class basic_regex; the - object's internal finite state machine is constructed from the regular - expression contained in the sequence of characters [p1,p2), and interpreted - according the option flags specified in f. - The postconditions of this function are indicated in the table:

-

-

-

-
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Element -

-
-

- Value

-

empty()

-
-

false

-
-

size()

-
-

std::distance(p1,p2)

-
-

str()

-
-

basic_string<charT>(p1,p2)

-
-

getflags()

-
-

f

-
-

mark_count()

-
-

The number of marked sub-expressions within the expression.

-

-
-

-
basic_regex(const charT* p, size_type len, flag_type f, const Allocator& a = Allocator());
- -

- Requires: p shall not be a null pointer, len < max_size().

-

- Throws: bad_expression if p is not a valid regular - expression.

-

- Effects: Constructs an object of class basic_regex; the - object's internal finite state machine is constructed from the regular - expression contained in the sequence of characters [p, p+len), and interpreted - according the option flags specified in f. - The postconditions of this function are indicated in the table:

-

-

-

-
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Element -

-
-

- Value

-

empty()

-
-

false

-
-

size()

-
-

len

-
-

str()

-
-

basic_string<charT>(p, len)

-
-

getflags()

-
-

f

-
-

mark_count()

-
-

The number of marked sub-expressions within the expression.

-

-
-

-
basic_regex(const basic_regex& e);
- -

- Effects: Constructs an object of class basic_regex as a - copy of the object e. The postconditions of this function are indicated - in the table:

-

-

-

-
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Element -

-
-

- Value

-

empty()

-
-

e.empty()

-
-

size()

-
-

e.size()

-
-

str()

-
-

e.str()

-
-

getflags()

-
-

e.getflags()

-
-

mark_count()

-
-

e.mark_count()

-

-
-

-
template <class ST, class SA>
+         member functions during the lifetime of the object.

+
+basic_regex(const Allocator& a = Allocator());
+
+ +

Effects: Constructs an object of class basic_regex. The + postconditions of this function are indicated in the table:

+

+
+

+
+ + + + + + + + + + + + + + + + + + + +
+

Element

+
+

Value

+
+

empty()

+
+

true

+
+

size()

+
+

0

+
+

str()

+
+

basic_string<charT>()

+
+
+
+
 
+
+
basic_regex(const charT* p, flag_type f = regex_constants::normal, const Allocator& a = Allocator());
+
+ +

Requires: p shall not be a null pointer.

+ +

Throws: bad_expression if p is not a valid regular + expression.

+ +

Effects: Constructs an object of class basic_regex; the + object's internal finite state machine is constructed from the regular + expression contained in the null-terminated string p, and interpreted + according to the option flags specified + in f. The postconditions of this function are indicated in the table:

+ +

+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Element

+
+

Value

+
+

empty()

+
+

false

+
+

size()

+
+

char_traits<charT>::length(p)

+
+

str()

+
+

basic_string<charT>(p)

+
+

getflags()

+
+

f

+
+

mark_count()

+
+

The number of marked sub-expressions within the expression.

+
+
+
+
 
+
+
basic_regex(const charT* p1, const charT* p2, flag_type f = regex_constants::normal, const Allocator& a = Allocator());
+
+ +

Requires: p1 and p2 are not null pointers, p1 < p2.

+ +

Throws: bad_expression if [p1,p2) is not a valid regular + expression.

+ +

Effects: Constructs an object of class basic_regex; the + object's internal finite state machine is constructed from the regular + expression contained in the sequence of characters [p1,p2), and interpreted + according the option flags specified in f. + The postconditions of this function are indicated in the table:

+ +

+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Element

+
+

Value

+
+

empty()

+
+

false

+
+

size()

+
+

std::distance(p1,p2)

+
+

str()

+
+

basic_string<charT>(p1,p2)

+
+

getflags()

+
+

f

+
+

mark_count()

+
+

The number of marked sub-expressions within the expression.

+
+
+
+
 
+
+
basic_regex(const charT* p, size_type len, flag_type f, const Allocator& a = Allocator());
+
+ +

Requires: p shall not be a null pointer, len < max_size().

+ +

Throws: bad_expression if p is not a valid regular + expression.

+ +

Effects: Constructs an object of class basic_regex; the + object's internal finite state machine is constructed from the regular + expression contained in the sequence of characters [p, p+len), and interpreted + according the option flags specified in f. + The postconditions of this function are indicated in the table:

+ +

+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Element

+
+

Value

+
+

empty()

+
+

false

+
+

size()

+
+

len

+
+

str()

+
+

basic_string<charT>(p, len)

+
+

getflags()

+
+

f

+
+

mark_count()

+
+

The number of marked sub-expressions within the expression.

+
+
+
+
  
+
+
basic_regex(const basic_regex& e);
+
+ +

Effects: Constructs an object of class basic_regex as a + copy of the object e. The postconditions of this function are indicated + in the table:

+ +

+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Element

+
+

Value

+
+

empty()

+
+

e.empty()

+
+

size()

+
+

e.size()

+
+

str()

+
+

e.str()

+
+

getflags()

+
+

e.getflags()

+
+

mark_count()

+
+

e.mark_count()

+
+
+
+
 
+
+
template <class ST, class SA>
 basic_regex(const basic_string<charT, ST, SA>& s,
-            flag_type f = regex_constants::normal, const Allocator& a = Allocator());
- -

- Throws: bad_expression if s is not a valid regular - expression.

-

- Effects: Constructs an object of class basic_regex; the - object's internal finite state machine is constructed from the regular - expression contained in the string s, and interpreted according to the - option flags specified in f. The postconditions of this function - are indicated in the table:

-

-

-

-
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Element -

-
-

- Value

-

empty()

-
-

false

-
-

size()

-
-

s.size()

-
-

str()

-
-

s

-
-

getflags()

-
-

f

-
-

mark_count()

-
-

The number of marked sub-expressions within the expression.

-

-
-

-
template <class ForwardIterator>
+            flag_type f = regex_constants::normal, const Allocator& a = Allocator());
+
+ +

Throws: bad_expression if s is not a valid regular + expression.

+ +

Effects: Constructs an object of class basic_regex; the + object's internal finite state machine is constructed from the regular + expression contained in the string s, and interpreted according to the + option flags specified in f. The postconditions of this function + are indicated in the table:

+ +

+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Element

+
+

Value

+
+

empty()

+
+

false

+
+

size()

+
+

s.size()

+
+

str()

+
+

s

+
+

getflags()

+
+

f

+
+

mark_count()

+
+

The number of marked sub-expressions within the expression.

+
+
+
+
 
+
+
template <class ForwardIterator>
 basic_regex(ForwardIterator first, ForwardIterator last,
-            flag_type f = regex_constants::normal, const Allocator& a = Allocator());
- -

- Throws: bad_expression if the sequence [first, last) - is not a valid regular expression.

-

- Effects: Constructs an object of class basic_regex; the - object's internal finite state machine is constructed from the regular - expression contained in the sequence of characters [first, last), and - interpreted according to the option flags - specified in f. The postconditions of this function are indicated in the - table:

-

-

-

-
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Element -

-
-

- Value

-

empty()

-
-

false

-
-

size()

-
-

distance(first,last)

-
-

str()

-
-

basic_string<charT>(first,last)

-
-

getflags()

-
-

f

-
-

mark_count()

-
-

The number of marked sub-expressions within the expression.

-

-
-

-
basic_regex& operator=(const basic_regex& e);
- -

- Effects: Returns the result of assign(e.str(), e.getflags()).

basic_regex& operator=(const charT* ptr);
- -

- Requires: p shall not be a null pointer.

-

- Effects: Returns the result of assign(ptr).

template <class ST, class SA>
-basic_regex& operator=(const basic_string<charT, ST, SA>& p);
- -

- Effects: Returns the result of assign(p).

-

basic_regex iterators

-
const_iterator begin() const;
- -

- Effects: Returns a starting iterator to a sequence of characters - representing the regular expression.

const_iterator end() const;
- -

- Effects: Returns termination iterator to a sequence of characters - representing the regular expression.

-

basic_regex capacity

-
size_type size() const;
- -

- Effects: Returns the length of the sequence of characters representing - the regular expression.

size_type max_size() const;
- -

- Effects: Returns the maximum length of the sequence of characters - representing the regular expression.

bool empty() const;
- -

- Effects: Returns true if the object does not contain a valid - regular expression, otherwise false.

unsigned mark_count() const;
- -

- Effects: Returns the number of marked sub-expressions within the regular - expresion.

-

basic_regex assign

-
basic_regex& assign(const basic_regex& that);
- -

- Effects: Returns assign(that.str(), that.getflags()).

basic_regex& assign(const charT* ptr, flag_type f = regex_constants::normal);
- -

- Effects: Returns assign(string_type(ptr), f).

basic_regex& assign(const charT* first, const charT* last,
-                    flag_type f = regex_constants::normal);
- -

- Effects: Returns assign(string_type(first, last), f).

template <class string_traits, class A>
+            flag_type f = regex_constants::normal, const Allocator& a = Allocator());
+
+ +

Throws: bad_expression if the sequence [first, last) + is not a valid regular expression.

+ +

Effects: Constructs an object of class basic_regex; the + object's internal finite state machine is constructed from the regular + expression contained in the sequence of characters [first, last), and + interpreted according to the option flags + specified in f. The postconditions of this function are indicated in the + table:

+ +

+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Element

+
+

Value

+
+

empty()

+
+

false

+
+

size()

+
+

distance(first,last)

+
+

str()

+
+

basic_string<charT>(first,last)

+
+

getflags()

+
+

f

+
+

mark_count()

+
+

The number of marked sub-expressions within the expression.

+
+
+
+
  
+
+
basic_regex& operator=(const basic_regex& e);
+
+ +

Effects: Returns the result of assign(e.str(), e.getflags()).

+
+basic_regex& operator=(const charT* ptr);
+
+ +

Requires: p shall not be a null pointer.

+ +

Effects: Returns the result of assign(ptr).

+
+template <class ST, class SA>
+basic_regex& operator=(const basic_string<charT, ST, SA>& p);
+
+ +

Effects: Returns the result of assign(p).

+

basic_regex iterators

+
+const_iterator begin() const;
+
+ +

Effects: Returns a starting iterator to a sequence of characters + representing the regular expression.

+
+const_iterator end() const;
+
+ +

Effects: Returns termination iterator to a sequence of characters + representing the regular expression.

+

basic_regex capacity

+
+size_type size() const;
+
+ +

Effects: Returns the length of the sequence of characters representing + the regular expression.

+
+size_type max_size() const;
+
+ +

Effects: Returns the maximum length of the sequence of characters + representing the regular expression.

+
+bool empty() const;
+
+ +

Effects: Returns true if the object does not contain a valid + regular expression, otherwise false.

+
+unsigned mark_count() const;
+
+ +

Effects: Returns the number of marked sub-expressions within the regular + expresion.

+

basic_regex assign

+
+basic_regex& assign(const basic_regex& that);
+
+ +

Effects: Returns assign(that.str(), that.getflags()).

+
+basic_regex& assign(const charT* ptr, flag_type f = regex_constants::normal);
+
+ +

Effects: Returns assign(string_type(ptr), f).

+
+basic_regex& assign(const charT* first, const charT* last,
+                    flag_type f = regex_constants::normal);
+
+ +

Effects: Returns assign(string_type(first, last), f).

+
+template <class string_traits, class A>
 basic_regex& assign(const basic_string<charT, string_traits, A>& s,
-                    flag_type f = regex_constants::normal);
- -

- Throws: bad_expression if s is not a valid regular - expression.

-

- Returns: *this.

-

- Effects: Assigns the regular expression contained in the string s, - interpreted according the option flags specified - in f. The postconditions of this function are indicated in the - table:

-

-

-

-
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Element -

-
-

- Value

-

empty()

-
-

false

-
-

size()

-
-

s.size()

-
-

str()

-
-

s

-
-

getflags()

-
-

f

-
-

mark_count()

-
-

The number of marked sub-expressions within the expression.

-

-
-

-
template <class InputIterator>
+                    flag_type f = regex_constants::normal);
+
+ +

Throws: bad_expression if s is not a valid regular + expression.

+ +

Returns: *this.

+ +

Effects: Assigns the regular expression contained in the string s, + interpreted according the option flags specified + in f. The postconditions of this function are indicated in the table:

+ +

+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Element

+
+

Value

+
+

empty()

+
+

false

+
+

size()

+
+

s.size()

+
+

str()

+
+

s

+
+

getflags()

+
+

f

+
+

mark_count()

+
+

The number of marked sub-expressions within the expression.

+
+
+
+
 
+
+
template <class InputIterator>
 basic_regex& assign(InputIterator first, InputIterator last,
-                    flag_type f = regex_constants::normal);
- -

- Requires: The type InputIterator corresponds to the Input Iterator - requirements (24.1.1).

-

- Effects: Returns assign(string_type(first, last), f).

-

basic_regex constant operations

-
Allocator get_allocator() const;
- -

- Effects: Returns a copy of the Allocator that was passed to the object's - constructor.

flag_type getflags() const;
- -

- Effects: Returns a copy of the regular expression syntax flags that were - passed to the object's constructor, or the last call to assign.

basic_string<charT> str() const;
- -

- Effects: Returns a copy of the character sequence passed to the object's - constructor, or the last call to assign.

int compare(basic_regex& e)const;
- -

- Effects: If getflags() == e.getflags() then returns str().compare(e.str()), - otherwise returns getflags() - e.getflags().

-

basic_regex locale

-
locale_type imbue(locale_type l);
- -

- Effects: Returns the result of traits_inst.imbue(l) where - traits_inst is a (default initialized) instance of the template - parameter traits stored within the object. Calls to imbue - invalidate any currently contained regular expression.

-

- Postcondition: empty() == true.

locale_type getloc() const;
- -

- Effects: Returns the result of traits_inst.getloc() where - traits_inst is a (default initialized) instance of the template - parameter traits stored within the object.

-

basic_regex swap

-
void swap(basic_regex& e) throw();
- -

- Effects: Swaps the contents of the two regular expressions.

-

- Postcondition: *this contains the characters that were in e, - e contains the regular expression that was in *this.

-

- Complexity: constant time.

-

basic_regex non-member functions

-
basic_regex non-member comparison operators 
-
template <class charT, class traits, class Allocator>
+                    flag_type f = regex_constants::normal);
+
+ +

Requires: The type InputIterator corresponds to the Input Iterator + requirements (24.1.1).

+ +

Effects: Returns assign(string_type(first, last), f).

+

basic_regex constant operations

+
+Allocator get_allocator() const;
+
+ +

Effects: Returns a copy of the Allocator that was passed to the object's + constructor.

+
+flag_type getflags() const;
+
+ +

Effects: Returns a copy of the regular expression syntax flags that were + passed to the object's constructor, or the last call to assign.

+
+basic_string<charT> str() const;
+
+ +

Effects: Returns a copy of the character sequence passed to the object's + constructor, or the last call to assign.

+
+int compare(basic_regex& e)const;
+
+ +

Effects: If getflags() == e.getflags() then returns str().compare(e.str()), + otherwise returns getflags() - e.getflags().

+

basic_regex locale

+
+locale_type imbue(locale_type l);
+
+ +

Effects: Returns the result of traits_inst.imbue(l) where + traits_inst is a (default initialized) instance of the template + parameter traits stored within the object. Calls to imbue + invalidate any currently contained regular expression.

+ +

Postcondition: empty() == true.

+
+locale_type getloc() const;
+
+ +

Effects: Returns the result of traits_inst.getloc() where + traits_inst is a (default initialized) instance of the template + parameter traits stored within the object.

+

basic_regex swap

+
+void swap(basic_regex& e) throw();
+
+ +

Effects: Swaps the contents of the two regular expressions.

+ +

Postcondition: *this contains the characters that were in e, + e contains the regular expression that was in *this.

+ +

Complexity: constant time.

+

basic_regex non-member functions

+
basic_regex non-member comparison operators 
+
+template <class charT, class traits, class Allocator>
 bool operator == (const basic_regex<charT, traits, Allocator>& lhs,
-                  const basic_regex<charT, traits, Allocator>& rhs);
- -

- Effects: Returns lhs.compare(rhs) == 0.

template <class charT, class traits, class Allocator>
+                  const basic_regex<charT, traits, Allocator>& rhs);
+
+ +

Effects: Returns lhs.compare(rhs) == 0.

+
+template <class charT, class traits, class Allocator>
 bool operator != (const basic_regex<charT, traits, Allocator>& lhs,
-                  const basic_regex<charT, traits, Allocator>& rhs);
- -

- Effects: Returns lhs.compare(rhs) != 0.

template <class charT, class traits, class Allocator>
+                  const basic_regex<charT, traits, Allocator>& rhs);
+
+ +

Effects: Returns lhs.compare(rhs) != 0.

+
+template <class charT, class traits, class Allocator>
 bool operator < (const basic_regex<charT, traits, Allocator>& lhs,
-                 const basic_regex<charT, traits, Allocator>& rhs);
- -

- Effects: Returns lhs.compare(rhs) < 0.

template <class charT, class traits, class Allocator>
+                 const basic_regex<charT, traits, Allocator>& rhs);
+
+ +

Effects: Returns lhs.compare(rhs) < 0.

+
+template <class charT, class traits, class Allocator>
 bool operator <= (const basic_regex<charT, traits, Allocator>& lhs,
-                  const basic_regex<charT, traits, Allocator>& rhs);
- -

- Effects: Returns lhs.compare(rhs) <= 0.

template <class charT, class traits, class Allocator>
+                  const basic_regex<charT, traits, Allocator>& rhs);
+
+ +

Effects: Returns lhs.compare(rhs) <= 0.

+
+template <class charT, class traits, class Allocator>
 bool operator >= (const basic_regex<charT, traits, Allocator>& lhs,
-                  const basic_regex<charT, traits, Allocator>& rhs);
- -

- Effects: Returns lhs.compare(rhs) >= 0.

template <class charT, class traits, class Allocator>
+                  const basic_regex<charT, traits, Allocator>& rhs);
+
+ +

Effects: Returns lhs.compare(rhs) >= 0.

+
+template <class charT, class traits, class Allocator>
 bool operator > (const basic_regex<charT, traits, Allocator>& lhs,
-                 const basic_regex<charT, traits, Allocator>& rhs);
- -

- Effects: Returns lhs.compare(rhs) > 0.

-
basic_regex inserter.
-
template <class charT, class io_traits, class re_traits, class Allocator>
+                 const basic_regex<charT, traits, Allocator>& rhs);
+
+ +

Effects: Returns lhs.compare(rhs) > 0.

+
basic_regex inserter.
+
+template <class charT, class io_traits, class re_traits, class Allocator>
 basic_ostream<charT, io_traits>&
    operator << (basic_ostream<charT, io_traits>& os
-                const basic_regex<charT, re_traits, Allocator>& e);
- -

- Effects: Returns (os << e.str()).

-
basic_regex non-member swap
-
template <class charT, class traits, class Allocator>
+                const basic_regex<charT, re_traits, Allocator>& e);
+
+ +

Effects: Returns (os << e.str()).

+
basic_regex non-member swap
+
+template <class charT, class traits, class Allocator>
 void swap(basic_regex<charT, traits, Allocator>& lhs,
-          basic_regex<charT, traits, Allocator>& rhs);
- -

- Effects: calls lhs.swap(rhs).

-

-


-

+ basic_regex<charT, traits, Allocator>& rhs); +
+ +

Effects: calls lhs.swap(rhs).

+

+

Revised 11 April 2003 - -

-

© Copyright John Maddock 1998- 2003

-

Permission to use, copy, modify, distribute and sell this software +

+

© Copyright John Maddock 1998- + + 2003 +

+

Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Dr John Maddock makes no representations about the suitability of this software - for any purpose. It is provided "as is" without express or implied warranty.

+ for any purpose. It is provided "as is" without express or implied warranty.

diff --git a/doc/Attic/configuration.html b/doc/Attic/configuration.html index 7cb8dfa8..0d3e2eb2 100644 --- a/doc/Attic/configuration.html +++ b/doc/Attic/configuration.html @@ -1,163 +1,245 @@ - - Boost.Regex: Configuration and setup - - - - -

- - - - - - -
-

C++ Boost

-
-

Boost.Regex

-

Configuration and setup

-
-

Boost.Regex Index

-
-

-
-

Contents

-
-
Compiler setup
-
Locale and traits class selection
-
Linkage Options
-
Algorithm Selection
-
Algorithm Tuning
-
-

Compiler setup.

-

You shouldn't need to do anything special to configure boost.regex for use with - your compiler - the boost.config subsystem - should already take care of it, if you do have problems (or you are using a - particularly obscure compiler or platform) then boost.config has - a configure script.

-

Locale and traits class selection.

-

The following macros (see user.hpp) - control how boost.regex interacts with the users locale:

-

- - - - - - - - - - - - - -
BOOST_REGEX_USE_C_LOCALEForces boost.regex to use the global C locale in it's traits class support: - this is the default behaviour on non-windows platforms, but MS Windows - platforms normally use the Win32 API for locale support.
BOOST_REGEX_USE_CPP_LOCALEForces boost.regex to use std::locale in it's default traits class, regular - expressions can then be imbued with an instance specific locale.
BOOST_REGEX_NO_W32Tells boost.regex not to use any Win32 API's even when available (implies - BOOST_REGEX_USE_C_LOCALE unless BOOST_REGEX_USE_CPP_LOCALE is set).
-

-

Linkage Options

-

- - - - - - - - - -
BOOST_REGEX_STATIC_LINKFor Microsoft and Borland C++ builds, this tells boost.regex that it is going - to be linked to a static library even when using a dynamic C runtime.
BOOST_REGEX_NO_LIBFor Microsoft and Borland C++ builds, this tells boost.regex that it should - not automatically select the library to link to.
-

-

Algorithm Selection

-

- - - - - - - - - - - - - -
BOOST_REGEX_V3Tells boost.regex to use the boost-1.30.0 matching algorithm, define only if - you need maximum compatibility with previous behaviour.
BOOST_REGEX_RECURSIVETells boost.regex to use a stack-recursive matching algorithm.  This is - generally the fastest option (although there is very little in it), but can - cause stack overflow in extreme cases, on Win32 this can be handled safely, but - this is not the case on other platforms.
BOOST_REGEX_NON_RECURSIVETells boost.regex to use a non-stack recursive matching algorithm, this can be - slightly slower than the alternative, but is always safe no matter how - pathological the regular expression.  This is the default on non-Win32 - platforms.
-

-

Algorithm Tuning

-

The following option applies only if BOOST_REGEX_RECURSIVE is set.

-

- - - - - -
BOOST_REGEX_HAS_MS_STACK_GUARDTells boost.regex that Microsoft style __try - __except blocks are supported, - and can be used to safely trap stack overflow.
-

-

The following options apply only if BOOST_REGEX_NON_RECURSIVE is set.

-

- - - - - - - - - - - - - -
BOOST_REGEX_BLOCKSIZEIn non-recursive mode, boost.regex uses largish blocks of memory to act as a - stack for the state machine, the larger the block size then the fewer - allocations that will take place.  This defaults to 4096 bytes, which is - large enough to match the vast majority of regular expressions without - further allocations, however, you can choose smaller or larger values depending - upon your platforms characteristics.
BOOST_REGEX_MAX_BLOCKSTells boost.regex how many blocks of size BOOST_REGEX_BLOCKSIZE it is - permitted to use.  If this value is exceeded then boost.regex will stop - trying to find a match and throw a std::runtime_error.  Defaults to 1024, - don't forget to tweek this value if you alter BOOST_REGEX_BLOCKSIZE by much.
BOOST_REGEX_MAX_CACHE_BLOCKSTells boost.regex how many memory blocks to store in it's internal cache - - memory blocks are taken from this cache rather than by calling ::operator - new.  Generally speeking this can be an order of magnitude faster than - calling ::opertator new each time a memory block is required, but has the - downside that boost.regex can end up caching a large chunk of memory (by - default up to 16 blocks each of BOOST_REGEX_BLOCKSIZE size).  If memory is - tight then try defining this to 0 (disables all caching), or if that is too - slow, then a value of 1 or 2, may be sufficient.  On the other hand, on - large multi-processor, multi-threaded systems, you may find that a higher value - is in order.
-

-

-


-

-

Revised - - 11 April 2003 - -

-

© Copyright John Maddock 1998- 2003

-

Permission to use, copy, modify, distribute and sell this software - and its documentation for any purpose is hereby granted without fee, provided - that the above copyright notice appear in all copies and that both that - copyright notice and this permission notice appear in supporting documentation. - Dr John Maddock makes no representations about the suitability of this software - for any purpose. It is provided "as is" without express or implied warranty.

- + +Boost.Regex: Configuration and setup + + + + + +

+ + + + + + + +
+

+"C++

+
+

Boost.Regex

+ +

Configuration and setup

+
+

+"Boost.Regex

+
+ +
+
+ + +
+

Contents

+ +
+
Compiler setup + +
Locale and traits class selection + +
Linkage Options + +
Algorithm Selection + +
Algorithm Tuning
+
+ +

Compiler setup.

+ +

You shouldn't need to do anything special to configure +boost.regex for use with your compiler - the boost.config subsystem should already +take care of it, if you do have problems (or you are using a +particularly obscure compiler or platform) then boost.config has a configure script.

+ +

Locale and traits class selection.

+ +

The following macros (see user.hpp) control how +boost.regex interacts with the user's locale:

+ +

+ + + + + + + + + + + + + + + + +
BOOST_REGEX_USE_C_LOCALEForces boost.regex to use the global C locale in its traits +class support: this is the default behavior on non-windows +platforms, but MS Windows platforms normally use the Win32 API for +locale support.
BOOST_REGEX_USE_CPP_LOCALEForces boost.regex to use std::locale in it's default traits +class, regular expressions can then be imbued with an +instance specific locale.
BOOST_REGEX_NO_W32Tells boost.regex not to use any Win32 API's even when +available (implies BOOST_REGEX_USE_C_LOCALE unless +BOOST_REGEX_USE_CPP_LOCALE is set).
+ +
+
+ + +

Linkage Options

+ +

+ + + + + + + + + + + +
BOOST_REGEX_DYN_LINKFor Microsoft and Borland C++ builds, this tells + boost.regex that it should link to the dll build of the boost.regex.  By default +boost.regex will link to its static library build, even if the dynamic C runtime library +is in use.
BOOST_REGEX_NO_LIBFor Microsoft and Borland C++ builds, this tells boost.regex +that it should not automatically select the library to link +to.
+ +
+
+ + +

Algorithm Selection

+ +

+ + + + + + + + + + + + + + + + +
BOOST_REGEX_V3Tells boost.regex to use the boost-1.30.0 matching algorithm, +define only if you need maximum compatibility with previous +behavior.
BOOST_REGEX_RECURSIVETells boost.regex to use a stack-recursive matching +algorithm.  This is generally the fastest option (although +there is very little in it), but can cause stack overflow in +extreme cases, on Win32 this can be handled safely, but this is not +the case on other platforms.
BOOST_REGEX_NON_RECURSIVETells boost.regex to use a non-stack recursive matching +algorithm, this can be slightly slower than the alternative, but is +always safe no matter how pathological the regular +expression.  This is the default on non-Win32 platforms.
+ +
+
+ + +

Algorithm Tuning

+ +

The following option applies only if BOOST_REGEX_RECURSIVE is +set.

+ +

+ + + + + + +
BOOST_REGEX_HAS_MS_STACK_GUARDTells boost.regex that Microsoft style __try - __except blocks +are supported, and can be used to safely trap stack overflow.
+ +
+
+ + +

The following options apply only if BOOST_REGEX_NON_RECURSIVE is +set.

+ +

+ + + + + + + + + + + + + + + + +
BOOST_REGEX_BLOCKSIZEIn non-recursive mode, boost.regex uses largish blocks of +memory to act as a stack for the state machine, the larger the +block size then the fewer allocations that will take place.  +This defaults to 4096 bytes, which is large enough to match the +vast majority of regular expressions without further +allocations, however, you can choose smaller or larger values +depending upon your platforms characteristics.
BOOST_REGEX_MAX_BLOCKSTells boost.regex how many blocks of size BOOST_REGEX_BLOCKSIZE +it is permitted to use.  If this value is exceeded then +boost.regex will stop trying to find a match and throw a +std::runtime_error.  Defaults to 1024, don't forget to tweek +this value if you alter BOOST_REGEX_BLOCKSIZE by much.
BOOST_REGEX_MAX_CACHE_BLOCKSTells boost.regex how many memory blocks to store in it's +internal cache - memory blocks are taken from this cache rather +than by calling ::operator new.  Generally speeking this can +be an order of magnitude faster than calling ::opertator new each +time a memory block is required, but has the downside that +boost.regex can end up caching a large chunk of memory (by default +up to 16 blocks each of BOOST_REGEX_BLOCKSIZE size).  If +memory is tight then try defining this to 0 (disables all caching), +or if that is too slow, then a value of 1 or 2, may be +sufficient.  On the other hand, on large multi-processor, +multi-threaded systems, you may find that a higher value is in +order.
+ +
+
+ + +

+ +
+

Revised +11 +April 2003 +

+ +

© Copyright John +Maddock 1998- +2003 +

+ +

Permission to use, copy, modify, distribute and +sell this software and its documentation for any purpose is hereby +granted without fee, provided that the above copyright notice +appear in all copies and that both that copyright notice and this +permission notice appear in supporting documentation. Dr John +Maddock makes no representations about the suitability of this +software for any purpose. It is provided "as is" without express or +implied warranty.

+ diff --git a/doc/Attic/contacts.html b/doc/Attic/contacts.html index 1f256990..25038d8a 100644 --- a/doc/Attic/contacts.html +++ b/doc/Attic/contacts.html @@ -1,86 +1,111 @@ - - Boost.Regex: Contacts - - - - -

- - - - - - -
-

C++ Boost

-
-

Boost.Regex

-

Contacts and Acknowledgements

-
-

Boost.Regex Index

-
-

-
-

-

The author can be contacted at John_Maddock@compuserve.com, - the home page for this library is at - http://ourworld.compuserve.com/homepages/John_Maddock/regexpp.htm, and - the official boost version can be obtained from www.boost.org/libraries.htm. -

-

I am indebted to Robert Sedgewick's "Algorithms in C++" for forcing me to think - about algorithms and their performance, and to the folks at boost for forcing - me to think, period. The following people have all contributed useful - comments or fixes: Dave Abrahams, Mike Allison, Edan Ayal, Jayashree - Balasubramanian, Jan Bölsche, Beman Dawes, Paul Baxter, David Bergman, David - Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno, Tobias - Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick Hodapp, Jesse Jones, - Martin Jost, Boris Krasnovskiy, Jan Hermelink, Max Leung, Wei-hao Lin, Jens - Maurer, Richard Peters, Heiko Schmidt, Jason Shirk, Gerald Slacik, Scobie - Smith, Mike Smyth, Alexander Sokolovsky, Hervé Poirier, Michael Raykh, Marc - Recht, Scott VanCamp, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward, - Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to the manuals - supplied with the Henry Spencer, Perl and GNU regular expression libraries - - wherever possible I have tried to maintain compatibility with these libraries - and with the POSIX standard - the code however is entirely my own, including - any bugs! I can absolutely guarantee that I will not fix any bugs I don't know - about, so if you have any comments or spot any bugs, please get in touch. -

-

Useful further information can be found at: -

-

A short tutorial on regular expressions - can be found here.

-

The Open Unix - Specification contains a wealth of useful material, including the - regular expression syntax, and specifications for - <regex.h> and - <nl_types.h>. -

-

The Pattern Matching Pointers - site is a "must visit" resource for anyone interested in pattern matching. -

-

Glimpse and Agrep, use a - simplified regular expression syntax to achieve faster search times. -

-

Udi Manber and - Ricardo Baeza-Yates - both have a selection of useful pattern matching papers available from their - respective web sites. -

-


-

-

Revised - - 11 April 2003 - -

-

© Copyright John Maddock 1998- 2003

-

Permission to use, copy, modify, distribute and sell this software - and its documentation for any purpose is hereby granted without fee, provided - that the above copyright notice appear in all copies and that both that - copyright notice and this permission notice appear in supporting documentation. - Dr John Maddock makes no representations about the suitability of this software - for any purpose. It is provided "as is" without express or implied warranty.

- + +Boost.Regex: Contacts + + + + + +

+ + + + + + + +
+

+"C++

+
+

Boost.Regex

+ +

Contacts and Acknowledgements

+
+

+"Boost.Regex

+
+ +
+
+ + +
+

The author can be contacted at +john_maddock@compuserve.com, the home page for this library is +at +http://ourworld.compuserve.com/homepages/john_maddock/regexpp.htm, +and the official boost version can be obtained from www.boost.org/libraries.htm.

+ +

I am indebted to Robert Sedgewick's "Algorithms in C++" for +forcing me to think about algorithms and their performance, and to +the folks at boost for forcing me to think, period. The +following people have all contributed useful comments or fixes: +Dave Abrahams, Mike Allison, Edan Ayal, Jayashree Balasubramanian, +Jan Bölsche, Beman Dawes, Paul Baxter, David Bergman, David +Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno, +Tobias Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick +Hodapp, Jesse Jones, Martin Jost, Boris Krasnovskiy, Jan Hermelink, +Max Leung, Wei-hao Lin, Jens Maurer, Richard Peters, Heiko Schmidt, +Jason Shirk, Gerald Slacik, Scobie Smith, Mike Smyth, Alexander +Sokolovsky, Hervé Poirier, Michael Raykh, Marc Recht, Scott +VanCamp, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward, +Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to +the manuals supplied with the Henry Spencer, Perl and GNU regular +expression libraries - wherever possible I have tried to maintain +compatibility with these libraries and with the POSIX standard - +the code however is entirely my own, including any bugs! I can +absolutely guarantee that I will not fix any bugs I don't know +about, so if you have any comments or spot any bugs, please get in +touch.

+ +

Useful further information can be found at:

+ +

A short tutorial on regular expressions can be +found here.

+ +

The Open Unix +Specification contains a wealth of useful material, including +the regular expression syntax, and specifications for +<regex.h> and +<nl_types.h>.

+ +

The Pattern +Matching Pointers site is a "must visit" resource for anyone +interested in pattern matching.

+ +

Glimpse and Agrep, +use a simplified regular expression syntax to achieve faster search +times.

+ +

Udi Manber +and Ricardo +Baeza-Yates both have a selection of useful pattern matching +papers available from their respective web sites.

+ +

+ +
+

Revised +11 +April 2003 +

+ +

© Copyright John +Maddock 1998- +2003 +

+ +

Permission to use, copy, modify, distribute and +sell this software and its documentation for any purpose is hereby +granted without fee, provided that the above copyright notice +appear in all copies and that both that copyright notice and this +permission notice appear in supporting documentation. Dr John +Maddock makes no representations about the suitability of this +software for any purpose. It is provided "as is" without express or +implied warranty.

+ diff --git a/doc/Attic/examples.html b/doc/Attic/examples.html index b8d61d2d..4e032d00 100644 --- a/doc/Attic/examples.html +++ b/doc/Attic/examples.html @@ -2,60 +2,51 @@ Boost.Regex: Examples + -

- - - - - - -
-

C++ Boost

-
-

Boost.Regex

-

Examples

-
-

Boost.Regex Index

-
-

-

+ + + + + + +
+

C++ Boost

+
+

Boost.Regex

+

Examples

+
+

Boost.Regex Index

+
+
+
+

There are three demo applications that ship with this library, they all come with makefiles for Borland, Microsoft and gcc compilers, otherwise you will - have to create your own makefiles. -

-
regress.exe: -
+ have to create your own makefiles.

+
regress.exe:

A regression test application that gives the matching/searching algorithms a full workout. The presence of this program is your guarantee that the library will behave as claimed - at least as far as those items tested are concerned - - if anyone spots anything that isn't being tested I'd be glad to hear about it. -

+ if anyone spots anything that isn't being tested I'd be glad to hear about it.

Files: parse.cpp, - regress.cpp, tests.cpp. -

-
jgrep.exe -
+ regress.cpp, tests.cpp.

+
jgrep.exe

A simple grep implementation, run with no command line options to find out its usage. Look at fileiter.cpp/fileiter.hpp and the mapfile class to see an example of a "smart" bidirectional iterator that - can be used with boost.regex or any other STL algorithm. -

+ can be used with boost.regex or any other STL algorithm.

Files: jgrep.cpp, - main.cpp. -

-
timer.exe -
+ main.cpp.

+
timer.exe

A simple interactive expression matching application, the results of all matches are timed, allowing the programmer to optimize their regular - expressions where performance is critical. -

-

Files: regex_timer.cpp. -

+ expressions where performance is critical.

+

Files: regex_timer.cpp.

Code snippets

The snippets examples contain the code examples used in the documentation:

credit_card_example.cpp: @@ -68,8 +59,7 @@ regex_grep example 1: searches a cpp file for class definitions.

regex_grep_example_2.cpp: regex_grep example 2: searches a cpp file for class definitions, using a global - callback function. -

+ callback function.

regex_grep_example_3.cpp: regex_grep example 2: searches a cpp file for class definitions, using a bound member function callback.

@@ -87,21 +77,23 @@

regex_split_example_1.cpp: regex_split example: split a string into tokens.

regex_split_example_2.cpp - : regex_split example: spit out linked URL's. -

-


+ : regex_split example: spit out linked URL's.

+

Revised - - 11 April 2003 - -

-

© Copyright John Maddock 1998- 2003

-

Permission to use, copy, modify, distribute and sell this software +11 +April 2003 +

+ +

© Copyright John +Maddock 1998- +2003 +

+

Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Dr John Maddock makes no representations about the suitability of this software - for any purpose. It is provided "as is" without express or implied warranty.

+ for any purpose. It is provided "as is" without express or implied warranty.

diff --git a/doc/Attic/format_syntax.html b/doc/Attic/format_syntax.html index dc71d6d8..3aa628bb 100644 --- a/doc/Attic/format_syntax.html +++ b/doc/Attic/format_syntax.html @@ -28,7 +28,7 @@ regex_merge and by match_results::format, and are used to transform one string into another.

-

There are three kind of format string: sed, perl and extended, the extended +

There are three kind of format string: sed, Perl and extended, the extended syntax is a superset of the others so this is covered first.

Extended format syntax @@ -49,7 +49,7 @@
Sub-expression expansions:

-

The following perl like expressions expand to a particular matched +

The following Perl like expressions expand to a particular matched sub-expression:
  @@ -158,7 +158,7 @@   \x{} - A possible unicode hexadecimal character - for + A possible Unicode hexadecimal character - for example \x{1A0}   diff --git a/doc/Attic/history.html b/doc/Attic/history.html index 126519f2..55f39aad 100644 --- a/doc/Attic/history.html +++ b/doc/Attic/history.html @@ -24,7 +24,20 @@


-

Todo.

+

Boost 1.31.0.

+


@@ -33,7 +46,7 @@ 11 April 2003

-

© Copyright John Maddock 1998- 2003

+

© Copyright John Maddock 1998- 2003

Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that diff --git a/doc/Attic/install.html b/doc/Attic/install.html index b816b2c8..5ed56831 100644 --- a/doc/Attic/install.html +++ b/doc/Attic/install.html @@ -134,9 +134,9 @@ directly to your project then define BOOST_REGEX_NO_LIB to disable automatic library selection.

Important: there have been some reports of - compiler-optimisation bugs affecting this library, (particularly with VC6 + compiler-optimization bugs affecting this library, (particularly with VC6 versions prior to service patch 5) the workaround is to build the library using - /Oityb1 rather than /O2. That is to use all optimisation settings except /Oa. + /Oityb1 rather than /O2. That is to use all optimization settings except /Oa. This problem is reported to affect some standard library code as well (in fact I'm not sure if the problem is with the regex code or the underlying standard library), so it's probably worthwhile applying this workaround in normal diff --git a/doc/Attic/introduction.html b/doc/Attic/introduction.html index ea0d588a..2f18e11a 100644 --- a/doc/Attic/introduction.html +++ b/doc/Attic/introduction.html @@ -26,16 +26,16 @@

Regular expressions are a form of pattern-matching that are often used in text processing; many users will be familiar with the Unix utilities grep, sed - and awk, and the programming language perl, each of which make + and awk, and the programming language Perl, each of which make extensive use of regular expressions. Traditionally C++ users have been limited to the POSIX C API's for manipulating regular expressions, and while regex++ does provide these API's, they do not represent the best way to use the library. For example regex++ can cope with wide character strings, or search - and replace operations (in a manner analogous to either sed or perl), something + and replace operations (in a manner analogous to either sed or Perl), something that traditional C libraries can not do.

The class boost::basic_regex is the key class in this library; it represents a "machine readable" regular expression, and is - very closely modelled on std::basic_string, think of it as a string plus the + very closely modeled on std::basic_string, think of it as a string plus the actual state-machine required by the regular expression algorithms. Like std::basic_string there are two typedefs that are almost always the means by which this class is referenced:

@@ -58,18 +58,18 @@ number is in the correct format. To match any digit we could use the regular expression [0-9], however ranges of characters like this are actually locale dependent. Instead we should use the POSIX standard form [[:digit:]], or the - regex++ and perl shorthand for this \d (note that many older libraries tended + regex++ and Perl shorthand for this \d (note that many older libraries tended to be hard-coded to the C-locale, consequently this was not an issue for them). That leaves us with the following regular expression to validate credit card number formats:

(\d{4}[- ]){3}\d{4}

Here the parenthesis act to group (and mark for future reference) sub-expressions, and the {4} means "repeat exactly 4 times". This is an example - of the extended regular expression syntax used by perl, awk and egrep. Regex++ + of the extended regular expression syntax used by Perl, awk and egrep. Regex++ also supports the older "basic" syntax used by sed and grep, but this is generally less useful, unless you already have some basic regular expressions that you need to reuse.

-

Now lets take that expression and place it in some C++ code to validate the +

Now let's take that expression and place it in some C++ code to validate the format of a credit card number:

bool validate_card_format(const std::string s)
 {
@@ -83,13 +83,13 @@
          examples assume that your compiler supports Koenig lookup, if yours doesn't 
          (for example VC6), then you will have to add some boost:: prefixes to some of 
          the function calls in the examples.

-

Those of you who are familiar with credit card processing, will have realised +

Those of you who are familiar with credit card processing, will have realized that while the format used above is suitable for human readable card numbers, it does not represent the format required by online credit card systems; these require the number as a string of 16 (or possibly 15) digits, without any intervening spaces. What we need is a means to convert easily between the two formats, and this is where search and replace comes in. Those who are familiar - with the utilities sed and perl will already be ahead here; we + with the utilities sed and Perl will already be ahead here; we need two strings - one a regular expression - the other a "format string" that provides a description of the text to replace the match with. In regex++ this search and replace operation is performed with the @@ -152,7 +152,7 @@ std::string human_readable_card_number(const std::string s) advanced features like multi-character collating elements and equivalence classes - as well as providing compatibility with other regular expression libraries including GNU and BSD4 regex packages, and to a more limited extent - perl 5. + Perl 5.


@@ -172,3 +172,4 @@ std::string human_readable_card_number(const std::string s) + diff --git a/doc/Attic/localisation.html b/doc/Attic/localisation.html index 45986f40..39b3cebc 100644 --- a/doc/Attic/localisation.html +++ b/doc/Attic/localisation.html @@ -50,8 +50,8 @@ LC_TYPE and LC_COLLATE categories.

There are three separate localization mechanisms supported by boost.regex:

-

Win32 localization model. -

+

Win32 localization model. +

This is the default model when the library is compiled under Win32, and is encapsulated by the traits class w32_regex_traits. When this model is in effect there is a single global locale as defined by the user's control panel @@ -65,7 +65,7 @@

which needs to be called with a string identifying the name of the resource dll, before your code compiles any regular expressions (but not - necessarily before you construct any reg_expression instances): + necessarily before you construct any basic_regex instances):

boost::w32_regex_traits<char>::set_message_catalogue("mydll.dll");

@@ -77,8 +77,8 @@ under NT, under Windows 9x the library degrades gracefully - characters 0 to 255 are supported, the remainder are treated as "unknown" graphic characters.

-

C localization model. -

+

C localization model. +

This is the default model when the library is compiled under an operating system other than Win32, and is encapsulated by the traits class c_regex_traits, Win32 users can force this model to take effect by defining the pre-processor @@ -92,7 +92,7 @@

which needs to be called with a string identifying the name of the message catalogue, before your code compiles any regular expressions (but not - necessarily before you construct any reg_expression instances): + necessarily before you construct any basic_regex instances):

boost::c_regex_traits<char>::set_message_catalogue("mycatalogue");

@@ -107,12 +107,12 @@ behave equivalent to most traditional regular expression libraries including version 1 of this library.

-

C++ localization model. -

+

C++ localization model. +

This model is only in effect if the library is built with the pre-processor symbol BOOST_REGEX_USE_CPP_LOCALE defined. When this model is in effect each - instance of reg_expression<> has its own instance of std::locale, class - reg_expression<> also has a member function imbue which allows the + instance of basic_regex<> has its own instance of std::locale, class + basic_regex<> also has a member function imbue which allows the locale for the expression to be set on a per-instance basis. Front end localization requires a POSIX message catalogue, which will be loaded via the std::messages facet of the expression's locale, the traits class exports the @@ -122,14 +122,14 @@

which needs to be called with a string identifying the name of the message catalogue, before your code compiles any regular expressions (but not - necessarily before you construct any reg_expression instances): + necessarily before you construct any basic_regex instances):

boost::cpp_regex_traits<char>::set_message_catalogue("mycatalogue");

-

Note that calling reg_expression<>::imbue will invalidate any expression - currently compiled in that instance of reg_expression<>. This model is - the one which closest fits the ethos of the C++ standard library, however it is - the model which will produce the slowest code, and which is the least well +

Note that calling basic_regex<>::imbue will invalidate any expression + currently compiled in that instance of basic_regex<>. This model is the + one which closest fits the ethos of the C++ standard library, however it is the + model which will produce the slowest code, and which is the least well supported by current standard library implementations, for example I have yet to find an implementation of std::locale which supports either message catalogues, or locales other than "C" or "POSIX". @@ -141,8 +141,8 @@ <boost/cregex.hpp> in your code. The best way to ensure this is to add the #define to <boost/regex/user.hpp>.

-

Providing a message catalogue: -

+

Providing a message catalogue: +

In order to localize the front end of the library, you need to provide the library with the appropriate message strings contained either in a resource dll's string table (Win32 model), or a POSIX message catalogue (C or C++ @@ -728,12 +728,7 @@

-


-   -

-

Custom error messages are loaded as follows: -
-   +

Custom error messages are loaded as follows: 

@@ -929,12 +924,7 @@

-


-   -

-

Custom character class names are loaded as followed: -
-   +

Custom character class names are loaded as followed: 

@@ -1090,9 +1080,6 @@

-


-   -

Finally, custom collating element names are loaded starting from message id 400, and terminating when the first load thereafter fails. Each message looks something like: "tagname string" where tagname is the name used inside diff --git a/doc/Attic/match_results.html b/doc/Attic/match_results.html index 9a0d1afc..ac7889a9 100644 --- a/doc/Attic/match_results.html +++ b/doc/Attic/match_results.html @@ -134,13 +134,7 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,

Effects: Constructs an object of class match_results. The postconditions - of this function are indicated in Table RE16:

-
- Table RE16--match_results(const Allocator&) effects
-

-

-

-
+ of this function are indicated in the table:

@@ -182,7 +176,9 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,

-
match_results(const match_results& m);
+
+

 

+
match_results(const match_results& m);

Effects: Constructs an object of class match_results, as a copy of @@ -190,26 +186,22 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,

Effects: Assigns m to *this. The postconditions of this function are - indicated in Table RE17:

-
Table RE17--match_results(const Allocator&) effects
-

-

-

-

-

- - - - - - diff --git a/doc/history.html b/doc/history.html index 126519f2..55f39aad 100644 --- a/doc/history.html +++ b/doc/history.html @@ -24,7 +24,20 @@


-

Todo.

+

Boost 1.31.0.

+
    +
  • + Completely rewritten pattern matching code - it is now up to 10 times faster + than before.
  • +
  • + Reorganized documentation.
  • +
  • + Deprecated all interfaces that are not part of the + regular expression standardization proposal.
  • +
  • + Added regex_iterator and regex_token_iterator.
  • +
  • + Added support for Perl style independent sub-expressions.


@@ -33,7 +46,7 @@ 11 April 2003

-

© Copyright John Maddock 1998- 2003

+

© Copyright John Maddock 1998- 2003

Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that diff --git a/doc/install.html b/doc/install.html index b816b2c8..5ed56831 100644 --- a/doc/install.html +++ b/doc/install.html @@ -134,9 +134,9 @@ directly to your project then define BOOST_REGEX_NO_LIB to disable automatic library selection.

Important: there have been some reports of - compiler-optimisation bugs affecting this library, (particularly with VC6 + compiler-optimization bugs affecting this library, (particularly with VC6 versions prior to service patch 5) the workaround is to build the library using - /Oityb1 rather than /O2. That is to use all optimisation settings except /Oa. + /Oityb1 rather than /O2. That is to use all optimization settings except /Oa. This problem is reported to affect some standard library code as well (in fact I'm not sure if the problem is with the regex code or the underlying standard library), so it's probably worthwhile applying this workaround in normal diff --git a/doc/introduction.html b/doc/introduction.html index ea0d588a..2f18e11a 100644 --- a/doc/introduction.html +++ b/doc/introduction.html @@ -26,16 +26,16 @@

Regular expressions are a form of pattern-matching that are often used in text processing; many users will be familiar with the Unix utilities grep, sed - and awk, and the programming language perl, each of which make + and awk, and the programming language Perl, each of which make extensive use of regular expressions. Traditionally C++ users have been limited to the POSIX C API's for manipulating regular expressions, and while regex++ does provide these API's, they do not represent the best way to use the library. For example regex++ can cope with wide character strings, or search - and replace operations (in a manner analogous to either sed or perl), something + and replace operations (in a manner analogous to either sed or Perl), something that traditional C libraries can not do.

The class boost::basic_regex is the key class in this library; it represents a "machine readable" regular expression, and is - very closely modelled on std::basic_string, think of it as a string plus the + very closely modeled on std::basic_string, think of it as a string plus the actual state-machine required by the regular expression algorithms. Like std::basic_string there are two typedefs that are almost always the means by which this class is referenced:

@@ -58,18 +58,18 @@ number is in the correct format. To match any digit we could use the regular expression [0-9], however ranges of characters like this are actually locale dependent. Instead we should use the POSIX standard form [[:digit:]], or the - regex++ and perl shorthand for this \d (note that many older libraries tended + regex++ and Perl shorthand for this \d (note that many older libraries tended to be hard-coded to the C-locale, consequently this was not an issue for them). That leaves us with the following regular expression to validate credit card number formats:

(\d{4}[- ]){3}\d{4}

Here the parenthesis act to group (and mark for future reference) sub-expressions, and the {4} means "repeat exactly 4 times". This is an example - of the extended regular expression syntax used by perl, awk and egrep. Regex++ + of the extended regular expression syntax used by Perl, awk and egrep. Regex++ also supports the older "basic" syntax used by sed and grep, but this is generally less useful, unless you already have some basic regular expressions that you need to reuse.

-

Now lets take that expression and place it in some C++ code to validate the +

Now let's take that expression and place it in some C++ code to validate the format of a credit card number:

bool validate_card_format(const std::string s)
 {
@@ -83,13 +83,13 @@
          examples assume that your compiler supports Koenig lookup, if yours doesn't 
          (for example VC6), then you will have to add some boost:: prefixes to some of 
          the function calls in the examples.

-

Those of you who are familiar with credit card processing, will have realised +

Those of you who are familiar with credit card processing, will have realized that while the format used above is suitable for human readable card numbers, it does not represent the format required by online credit card systems; these require the number as a string of 16 (or possibly 15) digits, without any intervening spaces. What we need is a means to convert easily between the two formats, and this is where search and replace comes in. Those who are familiar - with the utilities sed and perl will already be ahead here; we + with the utilities sed and Perl will already be ahead here; we need two strings - one a regular expression - the other a "format string" that provides a description of the text to replace the match with. In regex++ this search and replace operation is performed with the @@ -152,7 +152,7 @@ std::string human_readable_card_number(const std::string s) advanced features like multi-character collating elements and equivalence classes - as well as providing compatibility with other regular expression libraries including GNU and BSD4 regex packages, and to a more limited extent - perl 5. + Perl 5.


@@ -172,3 +172,4 @@ std::string human_readable_card_number(const std::string s) + diff --git a/doc/localisation.html b/doc/localisation.html index 45986f40..39b3cebc 100644 --- a/doc/localisation.html +++ b/doc/localisation.html @@ -50,8 +50,8 @@ LC_TYPE and LC_COLLATE categories.

There are three separate localization mechanisms supported by boost.regex:

-

Win32 localization model. -

+

Win32 localization model. +

This is the default model when the library is compiled under Win32, and is encapsulated by the traits class w32_regex_traits. When this model is in effect there is a single global locale as defined by the user's control panel @@ -65,7 +65,7 @@

which needs to be called with a string identifying the name of the resource dll, before your code compiles any regular expressions (but not - necessarily before you construct any reg_expression instances): + necessarily before you construct any basic_regex instances):

boost::w32_regex_traits<char>::set_message_catalogue("mydll.dll");

@@ -77,8 +77,8 @@ under NT, under Windows 9x the library degrades gracefully - characters 0 to 255 are supported, the remainder are treated as "unknown" graphic characters.

-

C localization model. -

+

C localization model. +

This is the default model when the library is compiled under an operating system other than Win32, and is encapsulated by the traits class c_regex_traits, Win32 users can force this model to take effect by defining the pre-processor @@ -92,7 +92,7 @@

which needs to be called with a string identifying the name of the message catalogue, before your code compiles any regular expressions (but not - necessarily before you construct any reg_expression instances): + necessarily before you construct any basic_regex instances):

boost::c_regex_traits<char>::set_message_catalogue("mycatalogue");

@@ -107,12 +107,12 @@ behave equivalent to most traditional regular expression libraries including version 1 of this library.

-

C++ localization model. -

+

C++ localization model. +

This model is only in effect if the library is built with the pre-processor symbol BOOST_REGEX_USE_CPP_LOCALE defined. When this model is in effect each - instance of reg_expression<> has its own instance of std::locale, class - reg_expression<> also has a member function imbue which allows the + instance of basic_regex<> has its own instance of std::locale, class + basic_regex<> also has a member function imbue which allows the locale for the expression to be set on a per-instance basis. Front end localization requires a POSIX message catalogue, which will be loaded via the std::messages facet of the expression's locale, the traits class exports the @@ -122,14 +122,14 @@

which needs to be called with a string identifying the name of the message catalogue, before your code compiles any regular expressions (but not - necessarily before you construct any reg_expression instances): + necessarily before you construct any basic_regex instances):

boost::cpp_regex_traits<char>::set_message_catalogue("mycatalogue");

-

Note that calling reg_expression<>::imbue will invalidate any expression - currently compiled in that instance of reg_expression<>. This model is - the one which closest fits the ethos of the C++ standard library, however it is - the model which will produce the slowest code, and which is the least well +

Note that calling basic_regex<>::imbue will invalidate any expression + currently compiled in that instance of basic_regex<>. This model is the + one which closest fits the ethos of the C++ standard library, however it is the + model which will produce the slowest code, and which is the least well supported by current standard library implementations, for example I have yet to find an implementation of std::locale which supports either message catalogues, or locales other than "C" or "POSIX". @@ -141,8 +141,8 @@ <boost/cregex.hpp> in your code. The best way to ensure this is to add the #define to <boost/regex/user.hpp>.

-

Providing a message catalogue: -

+

Providing a message catalogue: +

In order to localize the front end of the library, you need to provide the library with the appropriate message strings contained either in a resource dll's string table (Win32 model), or a POSIX message catalogue (C or C++ @@ -728,12 +728,7 @@

-

- Element -

-
-

- Value + indicated in the table:

+

+

+ + + + + + +
+

+ Element

-
+

+ Value

+

empty()

@@ -277,7 +269,7 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,

- +

match_results size

size_type size()const;
diff --git a/doc/Attic/partial_matches.html b/doc/Attic/partial_matches.html index 130c837d..4081ff98 100644 --- a/doc/Attic/partial_matches.html +++ b/doc/Attic/partial_matches.html @@ -40,7 +40,7 @@ by regex_match, regex_search or regex_grep):

- +
@@ -169,11 +169,11 @@ void search(std::istream& is)

Revised - + 11 April 2003

-

© Copyright John Maddock 1998- 2003

+

© Copyright John Maddock 1998- 2003

Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that diff --git a/doc/Attic/posix_api.html b/doc/Attic/posix_api.html index 89ae0a2f..2dd7a77e 100644 --- a/doc/Attic/posix_api.html +++ b/doc/Attic/posix_api.html @@ -158,8 +158,7 @@

- + @@ -277,7 +276,7 @@ 11 April 2003

-

© Copyright John Maddock 1998- 2003

+

© Copyright John Maddock 1998- 2003

Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that diff --git a/doc/Attic/regex_format.html b/doc/Attic/regex_format.html index 06de5621..9378debb 100644 --- a/doc/Attic/regex_format.html +++ b/doc/Attic/regex_format.html @@ -24,9 +24,9 @@


-

The algorithm regex_format is deprecated, new code should use +

The algorithm regex_format is deprecated; new code should use match_results::format instead.  Existing code will continue to compile, - the following documentation ius taken from the previous version of boost.regex + the following documentation is taken from the previous version of boost.regex and will not be further updated:

Algorithm regex_format

@@ -63,8 +63,6 @@ std::basic_string<charT> regex_format                                   const std::basic_string<charT>& fmt,                                   match_flag_type flags = 0);

Parameters to the main version of the function are passed as follows: -
-  

  Result
  REG_PERL  A shortcut for perl-like behavior: REG_EXTENDED - | REG_NOCOLLATE | REG_ESCAPE_IN_LISTSCompiles Perl like regular expressions.  
@@ -100,8 +98,6 @@ std::basic_string<charT> regex_format

Format flags are defined as follows: -
-  

@@ -140,9 +136,6 @@ std::basic_string<charT> regex_format

-


-   -

The format string syntax (and available options) is described more fully under format strings . @@ -154,7 +147,7 @@ std::basic_string<charT> regex_format 11 April 2003

-

© Copyright John Maddock 1998- 2003

+

© Copyright John Maddock 1998- 2003

Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that diff --git a/doc/Attic/regex_grep.html b/doc/Attic/regex_grep.html index 131f7c84..9ba7475f 100644 --- a/doc/Attic/regex_grep.html +++ b/doc/Attic/regex_grep.html @@ -24,7 +24,7 @@


-

The algorithm regex_grep is deprecated in favour of regex_iterator +

The algorithm regex_grep is deprecated in favor of regex_iterator which provides a more convenient and standard library friendly interface.

The following documentation is taken unchanged from the previous boost release, and will not be updated in future.

@@ -57,9 +57,7 @@               const basic_regex<charT, traits, Allocator>& e,                unsigned flags = match_default);

The parameters for the primary version of regex_grep have the following - meanings: -
-   + meanings: 

@@ -97,8 +95,8 @@

-

 The algorithm finds all of the non-overlapping matches of the expression - e, for each match it fills a match_results<iterator, +

The algorithm finds all of the non-overlapping matches of the expression e, for + each match it fills a match_results<iterator, Allocator> structure, which contains information on what matched, and calls the predicate foo, passing the match_results<iterator, Allocator> as a single argument. If the predicate returns true, then the grep operation @@ -364,11 +362,11 @@ index[std::string(what[5].first, what[5].second) + std::string(what[6].first, wh


Revised - + 11 April 2003

-

© Copyright John Maddock 1998- 2003

+

© Copyright John Maddock 1998- 2003

Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that diff --git a/doc/Attic/regex_iterator.html b/doc/Attic/regex_iterator.html index 95376f4a..14cc7a24 100644 --- a/doc/Attic/regex_iterator.html +++ b/doc/Attic/regex_iterator.html @@ -62,7 +62,7 @@ public:

Description

A regex_iterator is constructed from a pair of iterators, and enumerates all - occurances of a regular expression within that iterator range.

+ occurrences of a regular expression within that iterator range.

regex_iterator();

@@ -71,7 +71,7 @@ public: match_flag_type m = match_default);

- Effects: constructs a regex_iterator that will enumerate all occurances + Effects: constructs a regex_iterator that will enumerate all occurrences of the expression re, within the sequence [a,b), and found using match flags m.  The object re must exist for the lifetime of the regex_iterator.

regex_iterator(const regex_iterator& that);
@@ -93,11 +93,10 @@ public: Effects:
returns !(*this == that).

RE.8.1.1 regex_iterator dereference
const value_type& operator*();
- -

- Effects: dereferencing a regex_iterator object it yields a - const reference to a match_results object, - whose members are set as follows:

+

+ Effects: dereferencing a regex_iterator object it yields a + const reference to a match_results object, + whose members are set as follows:

@@ -196,9 +195,9 @@ public: - @@ -229,7 +228,6 @@ public: diff --git a/doc/bad_expression.html b/doc/bad_expression.html index cf840f34..8dd0c0b7 100644 --- a/doc/bad_expression.html +++ b/doc/bad_expression.html @@ -2,76 +2,80 @@ Boost.Regex: bad_expression + -

-

(*it)[0].matched

+

- true if a full match was found, and false if it was a + true if a full match was found, and false if it was a partial match (found as a result of the match_partial flag being set).

For all integers n < (*it).size(), true if sub-expression n participated in the match, false otherwise.

-

(*it).position(n)
- - - - - -
-

C++ Boost

-
-

Boost.Regex

-

class bad_expression

-
-

Boost.Regex Index

-
-

-

-

Synopsis

-

#include <boost/pat_except.hpp> -

-

The class bad_expression defines the type of objects thrown as + + + + + + +
+

C++ Boost

+
+

Boost.Regex

+

class bad_expression

+
+

Boost.Regex Index

+
+
+
+


+

Synopsis

+

#include <boost/pattern_except.hpp>

+

The class bad_expression defines the type of objects thrown as exceptions to report errors during the conversion from a string representing a - regular expression to a finite state machine.  

-
namespace boost{
+         regular expression to a finite state machine.  

+
+namespace boost{
 
-class bad_pattern : public std::runtime_error
+class bad_pattern : public std::runtime_error
 {
-public:
-   explicit bad_pattern(const std::string& s) : std::runtime_error(s){};
+public:
+   explicit bad_pattern(const std::string& s) : std::runtime_error(s){};
 };
 
-class bad_expression : public bad_pattern
+class bad_expression : public bad_pattern
 {
-public:
-   bad_expression(const std::string& s) : bad_pattern(s) {}
+public:
+   bad_expression(const std::string& s) : bad_pattern(s) {}
 };
 
 
-} // namespace boost
-

Description

-
bad_expression(const string& what_arg); 
-

Effects: Constructs an object of class bad_expression.

- -

- Postcondition: strcmp(what(), what_arg.c_str()) == 0. -

Footnotes: the class bad_pattern forms the base class for all - pattern-matching exceptions, of which bad_expression is one. The choice - of std::runtime_error as the base class for bad_pattern - is moot, depending upon how the library is used exceptions may be either logic - errors (programmer supplied expressions) or run time errors (user supplied - expressions). -

-


-

+} // namespace boost +
+

Description

+
+bad_expression(const string& what_arg);
+
+

Effects: Constructs an object of class bad_expression.

+ +

Postcondition: strcmp(what(), what_arg.c_str()) == 0.

+

Footnotes: the class bad_pattern forms the base class for all + pattern-matching exceptions, of which bad_expression is one. The choice + of std::runtime_error as the base class for bad_pattern is moot; + depending upon how the library is used exceptions may be either logic errors + (programmer supplied expressions) or run time errors (user supplied + expressions).

+

+

Revised - + 11 April 2003 - -

-

© Copyright John Maddock 1998- 2003

-

Permission to use, copy, modify, distribute and sell this software +

+

© Copyright John Maddock 1998- + + 2003 +

+

Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Dr John Maddock makes no representations about the suitability of this software - for any purpose. It is provided "as is" without express or implied warranty.

+ for any purpose. It is provided "as is" without express or implied warranty.

diff --git a/doc/basic_regex.html b/doc/basic_regex.html index 0a7a2775..bca08197 100644 --- a/doc/basic_regex.html +++ b/doc/basic_regex.html @@ -2,57 +2,57 @@ Boost.Regex: basic_regex + -

- - - - - - -
-

C++ Boost

-
-

Boost.Regex

-

basic_regex

-
-

Boost.Regex Index

-
-

-

-

Synopsis

-
#include <boost/regex.hpp> 
-

The template class basic_regex encapsulates regular expression parsing - and compilation. The class takes three template parameters: -

-

charT: determines the character type, i.e. either char or - wchar_t. -

-

traits: determines the behaviour of the character type, for + + + + + + +
+

C++ Boost

+
+

Boost.Regex

+

basic_regex

+
+

Boost.Regex Index

+
+
+
+


+

Synopsis

+
+#include <boost/regex.hpp>
+
+

The template class basic_regex encapsulates regular expression parsing + and compilation. The class takes three template parameters:

+

charT: determines the character type, i.e. either char or + wchar_t.

+

traits: determines the behavior of the character type, for example which character class names are recognized. A default traits class is - provided: regex_traits<charT>. -

-

Allocator: the allocator class used to allocate memory by the - class. -

-

For ease of use there are two typedefs that define the two standard basic_regex + provided: regex_traits<charT>.

+

Allocator: the allocator class used to allocate memory by the + class.

+

For ease of use there are two typedefs that define the two standard basic_regex instances, unless you want to use custom traits classes or allocators, you - won't need to use anything other than these: -

-
namespace boost{
-template <class charT, class traits = regex_traits<charT>, class Allocator = std::allocator<charT>  >
-class reg_expression;
-typedef reg_expression<char> regex;
-typedef reg_expression<wchar_t> wregex;
-}
-

The definition of reg_expression follows: it is based very closely on - class basic_string, and fulfils the requirements for a constant-container of charT. -

-
namespace boost{
+         won't need to use anything other than these:

+
+namespace boost{
+template <class charT, class traits = regex_traits<charT>, class Allocator = std::allocator<charT>  >
+class basic_regex;
+typedef basic_regex<char> regex;
+typedef basic_regex<wchar_t> wregex;
+}
+
+

The definition of basic_regex follows: it is based very closely on class + basic_string, and fulfils the requirements for a constant-container of charT.

+
+namespace boost{
 
 template <class charT,
           class traits = regex_traits<charT>,
@@ -180,12 +180,13 @@ void swap(basic_regex<charT, traits, Allocator>& e1,
 typedef basic_regex<char> regex;
 typedef basic_regex<wchar_t> wregex;
 
-} // namespace boost
-

Description

-

Class basic_regex has the following public member functions: -

-

basic_regex constants

-
static const regex_constants::syntax_option_type normal = regex_constants::normal;
+} // namespace boost
+
+

Description

+

Class basic_regex has the following public member functions:

+

basic_regex constants

+
+static const regex_constants::syntax_option_type normal = regex_constants::normal;
 static const regex_constants::syntax_option_type icase = regex_constants::icase;
 static const regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
 static const regex_constants::syntax_option_type optimize = regex_constants::optimize;
@@ -199,746 +200,790 @@ static const regex_constants::syntax_option_type awk = regex_constants::awk;
 static const regex_constants::syntax_option_type grep = regex_constants::grep;
 static const regex_constants::syntax_option_type egrep = regex_constants::egrep;
 static const regex_constants::syntax_option_type sed = basic = regex_constants::sed;
-static const regex_constants::syntax_option_type perl = regex_constants::perl;
-

The static constant members are provided as synonyms for the constants declared - in namespace boost::regex_constants; for each constant of type syntax_option_type - declared in namespace boost::regex_constants then a constant with - the same name, type and value is declared within the scope of basic_regex.

-

basic_regex constructors

-

In all basic_regex constructors, a copy of the Allocator +static const regex_constants::syntax_option_type perl = regex_constants::perl; +

+

The static constant members are provided as synonyms for the constants declared + in namespace boost::regex_constants; for each constant of type syntax_option_type + declared in namespace boost::regex_constants then a constant with + the same name, type and value is declared within the scope of basic_regex.

+

basic_regex constructors

+

In all basic_regex constructors, a copy of the Allocator argument is used for any memory allocation performed by the constructor or - member functions during the lifetime of the object. -

-
basic_regex(const Allocator& a = Allocator());
- -

- Effects: Constructs an object of class basic_regex. The - postconditions of this function are indicated in the table:

-

-

-

-
-

-

- - - - - - - - - - - - - - - - - - -
-

- Element -

-
-

- Value

-

empty()

-
-

true

-
-

size()

-
-

0

-
-

str()

-
-

basic_string<charT>()

-

-
-

-
basic_regex(const charT* p, flag_type f = regex_constants::normal, const Allocator& a = Allocator());
- -

- Requires: p shall not be a null pointer.

-

- Throws: bad_expression if p is not a valid regular - expression.

-

- Effects: Constructs an object of class basic_regex; the - object's internal finite state machine is constructed from the regular - expression contained in the null-terminated string p, and interpreted - according to the option flags specified - in f. The postconditions of this function are indicated in the - table:

-

-

-

-
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Element -

-
-

- Value

-

empty()

-
-

false

-
-

size()

-
-

char_traits<charT>::length(p)

-
-

str()

-
-

basic_string<charT>(p)

-
-

getflags()

-
-

f

-
-

mark_count()

-
-

The number of marked sub-expressions within the expression.

-

-
-

-
basic_regex(const charT* p1, const charT* p2, flag_type f = regex_constants::normal, const Allocator& a = Allocator());
- -

- Requires: p1 and p2 are not null pointers, p1 < p2.

-

- Throws: bad_expression if [p1,p2) is not a valid regular - expression.

-

- Effects: Constructs an object of class basic_regex; the - object's internal finite state machine is constructed from the regular - expression contained in the sequence of characters [p1,p2), and interpreted - according the option flags specified in f. - The postconditions of this function are indicated in the table:

-

-

-

-
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Element -

-
-

- Value

-

empty()

-
-

false

-
-

size()

-
-

std::distance(p1,p2)

-
-

str()

-
-

basic_string<charT>(p1,p2)

-
-

getflags()

-
-

f

-
-

mark_count()

-
-

The number of marked sub-expressions within the expression.

-

-
-

-
basic_regex(const charT* p, size_type len, flag_type f, const Allocator& a = Allocator());
- -

- Requires: p shall not be a null pointer, len < max_size().

-

- Throws: bad_expression if p is not a valid regular - expression.

-

- Effects: Constructs an object of class basic_regex; the - object's internal finite state machine is constructed from the regular - expression contained in the sequence of characters [p, p+len), and interpreted - according the option flags specified in f. - The postconditions of this function are indicated in the table:

-

-

-

-
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Element -

-
-

- Value

-

empty()

-
-

false

-
-

size()

-
-

len

-
-

str()

-
-

basic_string<charT>(p, len)

-
-

getflags()

-
-

f

-
-

mark_count()

-
-

The number of marked sub-expressions within the expression.

-

-
-

-
basic_regex(const basic_regex& e);
- -

- Effects: Constructs an object of class basic_regex as a - copy of the object e. The postconditions of this function are indicated - in the table:

-

-

-

-
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Element -

-
-

- Value

-

empty()

-
-

e.empty()

-
-

size()

-
-

e.size()

-
-

str()

-
-

e.str()

-
-

getflags()

-
-

e.getflags()

-
-

mark_count()

-
-

e.mark_count()

-

-
-

-
template <class ST, class SA>
+         member functions during the lifetime of the object.

+
+basic_regex(const Allocator& a = Allocator());
+
+ +

Effects: Constructs an object of class basic_regex. The + postconditions of this function are indicated in the table:

+

+
+

+
+ + + + + + + + + + + + + + + + + + + +
+

Element

+
+

Value

+
+

empty()

+
+

true

+
+

size()

+
+

0

+
+

str()

+
+

basic_string<charT>()

+
+
+
+
 
+
+
basic_regex(const charT* p, flag_type f = regex_constants::normal, const Allocator& a = Allocator());
+
+ +

Requires: p shall not be a null pointer.

+ +

Throws: bad_expression if p is not a valid regular + expression.

+ +

Effects: Constructs an object of class basic_regex; the + object's internal finite state machine is constructed from the regular + expression contained in the null-terminated string p, and interpreted + according to the option flags specified + in f. The postconditions of this function are indicated in the table:

+ +

+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Element

+
+

Value

+
+

empty()

+
+

false

+
+

size()

+
+

char_traits<charT>::length(p)

+
+

str()

+
+

basic_string<charT>(p)

+
+

getflags()

+
+

f

+
+

mark_count()

+
+

The number of marked sub-expressions within the expression.

+
+
+
+
 
+
+
basic_regex(const charT* p1, const charT* p2, flag_type f = regex_constants::normal, const Allocator& a = Allocator());
+
+ +

Requires: p1 and p2 are not null pointers, p1 < p2.

+ +

Throws: bad_expression if [p1,p2) is not a valid regular + expression.

+ +

Effects: Constructs an object of class basic_regex; the + object's internal finite state machine is constructed from the regular + expression contained in the sequence of characters [p1,p2), and interpreted + according the option flags specified in f. + The postconditions of this function are indicated in the table:

+ +

+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Element

+
+

Value

+
+

empty()

+
+

false

+
+

size()

+
+

std::distance(p1,p2)

+
+

str()

+
+

basic_string<charT>(p1,p2)

+
+

getflags()

+
+

f

+
+

mark_count()

+
+

The number of marked sub-expressions within the expression.

+
+
+
+
 
+
+
basic_regex(const charT* p, size_type len, flag_type f, const Allocator& a = Allocator());
+
+ +

Requires: p shall not be a null pointer, len < max_size().

+ +

Throws: bad_expression if p is not a valid regular + expression.

+ +

Effects: Constructs an object of class basic_regex; the + object's internal finite state machine is constructed from the regular + expression contained in the sequence of characters [p, p+len), and interpreted + according the option flags specified in f. + The postconditions of this function are indicated in the table:

+ +

+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Element

+
+

Value

+
+

empty()

+
+

false

+
+

size()

+
+

len

+
+

str()

+
+

basic_string<charT>(p, len)

+
+

getflags()

+
+

f

+
+

mark_count()

+
+

The number of marked sub-expressions within the expression.

+
+
+
+
  
+
+
basic_regex(const basic_regex& e);
+
+ +

Effects: Constructs an object of class basic_regex as a + copy of the object e. The postconditions of this function are indicated + in the table:

+ +

+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Element

+
+

Value

+
+

empty()

+
+

e.empty()

+
+

size()

+
+

e.size()

+
+

str()

+
+

e.str()

+
+

getflags()

+
+

e.getflags()

+
+

mark_count()

+
+

e.mark_count()

+
+
+
+
 
+
+
template <class ST, class SA>
 basic_regex(const basic_string<charT, ST, SA>& s,
-            flag_type f = regex_constants::normal, const Allocator& a = Allocator());
- -

- Throws: bad_expression if s is not a valid regular - expression.

-

- Effects: Constructs an object of class basic_regex; the - object's internal finite state machine is constructed from the regular - expression contained in the string s, and interpreted according to the - option flags specified in f. The postconditions of this function - are indicated in the table:

-

-

-

-
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Element -

-
-

- Value

-

empty()

-
-

false

-
-

size()

-
-

s.size()

-
-

str()

-
-

s

-
-

getflags()

-
-

f

-
-

mark_count()

-
-

The number of marked sub-expressions within the expression.

-

-
-

-
template <class ForwardIterator>
+            flag_type f = regex_constants::normal, const Allocator& a = Allocator());
+
+ +

Throws: bad_expression if s is not a valid regular + expression.

+ +

Effects: Constructs an object of class basic_regex; the + object's internal finite state machine is constructed from the regular + expression contained in the string s, and interpreted according to the + option flags specified in f. The postconditions of this function + are indicated in the table:

+ +

+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Element

+
+

Value

+
+

empty()

+
+

false

+
+

size()

+
+

s.size()

+
+

str()

+
+

s

+
+

getflags()

+
+

f

+
+

mark_count()

+
+

The number of marked sub-expressions within the expression.

+
+
+
+
 
+
+
template <class ForwardIterator>
 basic_regex(ForwardIterator first, ForwardIterator last,
-            flag_type f = regex_constants::normal, const Allocator& a = Allocator());
- -

- Throws: bad_expression if the sequence [first, last) - is not a valid regular expression.

-

- Effects: Constructs an object of class basic_regex; the - object's internal finite state machine is constructed from the regular - expression contained in the sequence of characters [first, last), and - interpreted according to the option flags - specified in f. The postconditions of this function are indicated in the - table:

-

-

-

-
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Element -

-
-

- Value

-

empty()

-
-

false

-
-

size()

-
-

distance(first,last)

-
-

str()

-
-

basic_string<charT>(first,last)

-
-

getflags()

-
-

f

-
-

mark_count()

-
-

The number of marked sub-expressions within the expression.

-

-
-

-
basic_regex& operator=(const basic_regex& e);
- -

- Effects: Returns the result of assign(e.str(), e.getflags()).

basic_regex& operator=(const charT* ptr);
- -

- Requires: p shall not be a null pointer.

-

- Effects: Returns the result of assign(ptr).

template <class ST, class SA>
-basic_regex& operator=(const basic_string<charT, ST, SA>& p);
- -

- Effects: Returns the result of assign(p).

-

basic_regex iterators

-
const_iterator begin() const;
- -

- Effects: Returns a starting iterator to a sequence of characters - representing the regular expression.

const_iterator end() const;
- -

- Effects: Returns termination iterator to a sequence of characters - representing the regular expression.

-

basic_regex capacity

-
size_type size() const;
- -

- Effects: Returns the length of the sequence of characters representing - the regular expression.

size_type max_size() const;
- -

- Effects: Returns the maximum length of the sequence of characters - representing the regular expression.

bool empty() const;
- -

- Effects: Returns true if the object does not contain a valid - regular expression, otherwise false.

unsigned mark_count() const;
- -

- Effects: Returns the number of marked sub-expressions within the regular - expresion.

-

basic_regex assign

-
basic_regex& assign(const basic_regex& that);
- -

- Effects: Returns assign(that.str(), that.getflags()).

basic_regex& assign(const charT* ptr, flag_type f = regex_constants::normal);
- -

- Effects: Returns assign(string_type(ptr), f).

basic_regex& assign(const charT* first, const charT* last,
-                    flag_type f = regex_constants::normal);
- -

- Effects: Returns assign(string_type(first, last), f).

template <class string_traits, class A>
+            flag_type f = regex_constants::normal, const Allocator& a = Allocator());
+
+ +

Throws: bad_expression if the sequence [first, last) + is not a valid regular expression.

+ +

Effects: Constructs an object of class basic_regex; the + object's internal finite state machine is constructed from the regular + expression contained in the sequence of characters [first, last), and + interpreted according to the option flags + specified in f. The postconditions of this function are indicated in the + table:

+ +

+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Element

+
+

Value

+
+

empty()

+
+

false

+
+

size()

+
+

distance(first,last)

+
+

str()

+
+

basic_string<charT>(first,last)

+
+

getflags()

+
+

f

+
+

mark_count()

+
+

The number of marked sub-expressions within the expression.

+
+
+
+
  
+
+
basic_regex& operator=(const basic_regex& e);
+
+ +

Effects: Returns the result of assign(e.str(), e.getflags()).

+
+basic_regex& operator=(const charT* ptr);
+
+ +

Requires: p shall not be a null pointer.

+ +

Effects: Returns the result of assign(ptr).

+
+template <class ST, class SA>
+basic_regex& operator=(const basic_string<charT, ST, SA>& p);
+
+ +

Effects: Returns the result of assign(p).

+

basic_regex iterators

+
+const_iterator begin() const;
+
+ +

Effects: Returns a starting iterator to a sequence of characters + representing the regular expression.

+
+const_iterator end() const;
+
+ +

Effects: Returns termination iterator to a sequence of characters + representing the regular expression.

+

basic_regex capacity

+
+size_type size() const;
+
+ +

Effects: Returns the length of the sequence of characters representing + the regular expression.

+
+size_type max_size() const;
+
+ +

Effects: Returns the maximum length of the sequence of characters + representing the regular expression.

+
+bool empty() const;
+
+ +

Effects: Returns true if the object does not contain a valid + regular expression, otherwise false.

+
+unsigned mark_count() const;
+
+ +

Effects: Returns the number of marked sub-expressions within the regular + expresion.

+

basic_regex assign

+
+basic_regex& assign(const basic_regex& that);
+
+ +

Effects: Returns assign(that.str(), that.getflags()).

+
+basic_regex& assign(const charT* ptr, flag_type f = regex_constants::normal);
+
+ +

Effects: Returns assign(string_type(ptr), f).

+
+basic_regex& assign(const charT* first, const charT* last,
+                    flag_type f = regex_constants::normal);
+
+ +

Effects: Returns assign(string_type(first, last), f).

+
+template <class string_traits, class A>
 basic_regex& assign(const basic_string<charT, string_traits, A>& s,
-                    flag_type f = regex_constants::normal);
- -

- Throws: bad_expression if s is not a valid regular - expression.

-

- Returns: *this.

-

- Effects: Assigns the regular expression contained in the string s, - interpreted according the option flags specified - in f. The postconditions of this function are indicated in the - table:

-

-

-

-
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- Element -

-
-

- Value

-

empty()

-
-

false

-
-

size()

-
-

s.size()

-
-

str()

-
-

s

-
-

getflags()

-
-

f

-
-

mark_count()

-
-

The number of marked sub-expressions within the expression.

-

-
-

-
template <class InputIterator>
+                    flag_type f = regex_constants::normal);
+
+ +

Throws: bad_expression if s is not a valid regular + expression.

+ +

Returns: *this.

+ +

Effects: Assigns the regular expression contained in the string s, + interpreted according the option flags specified + in f. The postconditions of this function are indicated in the table:

+ +

+
+

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Element

+
+

Value

+
+

empty()

+
+

false

+
+

size()

+
+

s.size()

+
+

str()

+
+

s

+
+

getflags()

+
+

f

+
+

mark_count()

+
+

The number of marked sub-expressions within the expression.

+
+
+
+
 
+
+
template <class InputIterator>
 basic_regex& assign(InputIterator first, InputIterator last,
-                    flag_type f = regex_constants::normal);
- -

- Requires: The type InputIterator corresponds to the Input Iterator - requirements (24.1.1).

-

- Effects: Returns assign(string_type(first, last), f).

-

basic_regex constant operations

-
Allocator get_allocator() const;
- -

- Effects: Returns a copy of the Allocator that was passed to the object's - constructor.

flag_type getflags() const;
- -

- Effects: Returns a copy of the regular expression syntax flags that were - passed to the object's constructor, or the last call to assign.

basic_string<charT> str() const;
- -

- Effects: Returns a copy of the character sequence passed to the object's - constructor, or the last call to assign.

int compare(basic_regex& e)const;
- -

- Effects: If getflags() == e.getflags() then returns str().compare(e.str()), - otherwise returns getflags() - e.getflags().

-

basic_regex locale

-
locale_type imbue(locale_type l);
- -

- Effects: Returns the result of traits_inst.imbue(l) where - traits_inst is a (default initialized) instance of the template - parameter traits stored within the object. Calls to imbue - invalidate any currently contained regular expression.

-

- Postcondition: empty() == true.

locale_type getloc() const;
- -

- Effects: Returns the result of traits_inst.getloc() where - traits_inst is a (default initialized) instance of the template - parameter traits stored within the object.

-

basic_regex swap

-
void swap(basic_regex& e) throw();
- -

- Effects: Swaps the contents of the two regular expressions.

-

- Postcondition: *this contains the characters that were in e, - e contains the regular expression that was in *this.

-

- Complexity: constant time.

-

basic_regex non-member functions

-
basic_regex non-member comparison operators 
-
template <class charT, class traits, class Allocator>
+                    flag_type f = regex_constants::normal);
+
+ +

Requires: The type InputIterator corresponds to the Input Iterator + requirements (24.1.1).

+ +

Effects: Returns assign(string_type(first, last), f).

+

basic_regex constant operations

+
+Allocator get_allocator() const;
+
+ +

Effects: Returns a copy of the Allocator that was passed to the object's + constructor.

+
+flag_type getflags() const;
+
+ +

Effects: Returns a copy of the regular expression syntax flags that were + passed to the object's constructor, or the last call to assign.

+
+basic_string<charT> str() const;
+
+ +

Effects: Returns a copy of the character sequence passed to the object's + constructor, or the last call to assign.

+
+int compare(basic_regex& e)const;
+
+ +

Effects: If getflags() == e.getflags() then returns str().compare(e.str()), + otherwise returns getflags() - e.getflags().

+

basic_regex locale

+
+locale_type imbue(locale_type l);
+
+ +

Effects: Returns the result of traits_inst.imbue(l) where + traits_inst is a (default initialized) instance of the template + parameter traits stored within the object. Calls to imbue + invalidate any currently contained regular expression.

+ +

Postcondition: empty() == true.

+
+locale_type getloc() const;
+
+ +

Effects: Returns the result of traits_inst.getloc() where + traits_inst is a (default initialized) instance of the template + parameter traits stored within the object.

+

basic_regex swap

+
+void swap(basic_regex& e) throw();
+
+ +

Effects: Swaps the contents of the two regular expressions.

+ +

Postcondition: *this contains the characters that were in e, + e contains the regular expression that was in *this.

+ +

Complexity: constant time.

+

basic_regex non-member functions

+
basic_regex non-member comparison operators 
+
+template <class charT, class traits, class Allocator>
 bool operator == (const basic_regex<charT, traits, Allocator>& lhs,
-                  const basic_regex<charT, traits, Allocator>& rhs);
- -

- Effects: Returns lhs.compare(rhs) == 0.

template <class charT, class traits, class Allocator>
+                  const basic_regex<charT, traits, Allocator>& rhs);
+
+ +

Effects: Returns lhs.compare(rhs) == 0.

+
+template <class charT, class traits, class Allocator>
 bool operator != (const basic_regex<charT, traits, Allocator>& lhs,
-                  const basic_regex<charT, traits, Allocator>& rhs);
- -

- Effects: Returns lhs.compare(rhs) != 0.

template <class charT, class traits, class Allocator>
+                  const basic_regex<charT, traits, Allocator>& rhs);
+
+ +

Effects: Returns lhs.compare(rhs) != 0.

+
+template <class charT, class traits, class Allocator>
 bool operator < (const basic_regex<charT, traits, Allocator>& lhs,
-                 const basic_regex<charT, traits, Allocator>& rhs);
- -

- Effects: Returns lhs.compare(rhs) < 0.

template <class charT, class traits, class Allocator>
+                 const basic_regex<charT, traits, Allocator>& rhs);
+
+ +

Effects: Returns lhs.compare(rhs) < 0.

+
+template <class charT, class traits, class Allocator>
 bool operator <= (const basic_regex<charT, traits, Allocator>& lhs,
-                  const basic_regex<charT, traits, Allocator>& rhs);
- -

- Effects: Returns lhs.compare(rhs) <= 0.

template <class charT, class traits, class Allocator>
+                  const basic_regex<charT, traits, Allocator>& rhs);
+
+ +

Effects: Returns lhs.compare(rhs) <= 0.

+
+template <class charT, class traits, class Allocator>
 bool operator >= (const basic_regex<charT, traits, Allocator>& lhs,
-                  const basic_regex<charT, traits, Allocator>& rhs);
- -

- Effects: Returns lhs.compare(rhs) >= 0.

template <class charT, class traits, class Allocator>
+                  const basic_regex<charT, traits, Allocator>& rhs);
+
+ +

Effects: Returns lhs.compare(rhs) >= 0.

+
+template <class charT, class traits, class Allocator>
 bool operator > (const basic_regex<charT, traits, Allocator>& lhs,
-                 const basic_regex<charT, traits, Allocator>& rhs);
- -

- Effects: Returns lhs.compare(rhs) > 0.

-
basic_regex inserter.
-
template <class charT, class io_traits, class re_traits, class Allocator>
+                 const basic_regex<charT, traits, Allocator>& rhs);
+
+ +

Effects: Returns lhs.compare(rhs) > 0.

+
basic_regex inserter.
+
+template <class charT, class io_traits, class re_traits, class Allocator>
 basic_ostream<charT, io_traits>&
    operator << (basic_ostream<charT, io_traits>& os
-                const basic_regex<charT, re_traits, Allocator>& e);
- -

- Effects: Returns (os << e.str()).

-
basic_regex non-member swap
-
template <class charT, class traits, class Allocator>
+                const basic_regex<charT, re_traits, Allocator>& e);
+
+ +

Effects: Returns (os << e.str()).

+
basic_regex non-member swap
+
+template <class charT, class traits, class Allocator>
 void swap(basic_regex<charT, traits, Allocator>& lhs,
-          basic_regex<charT, traits, Allocator>& rhs);
- -

- Effects: calls lhs.swap(rhs).

-

-


-

+ basic_regex<charT, traits, Allocator>& rhs); +
+ +

Effects: calls lhs.swap(rhs).

+

+

Revised 11 April 2003 - -

-

© Copyright John Maddock 1998- 2003

-

Permission to use, copy, modify, distribute and sell this software +

+

© Copyright John Maddock 1998- + + 2003 +

+

Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Dr John Maddock makes no representations about the suitability of this software - for any purpose. It is provided "as is" without express or implied warranty.

+ for any purpose. It is provided "as is" without express or implied warranty.

diff --git a/doc/configuration.html b/doc/configuration.html index 7cb8dfa8..0d3e2eb2 100644 --- a/doc/configuration.html +++ b/doc/configuration.html @@ -1,163 +1,245 @@ - - Boost.Regex: Configuration and setup - - - - -

- - - - - - -
-

C++ Boost

-
-

Boost.Regex

-

Configuration and setup

-
-

Boost.Regex Index

-
-

-
-

Contents

-
-
Compiler setup
-
Locale and traits class selection
-
Linkage Options
-
Algorithm Selection
-
Algorithm Tuning
-
-

Compiler setup.

-

You shouldn't need to do anything special to configure boost.regex for use with - your compiler - the boost.config subsystem - should already take care of it, if you do have problems (or you are using a - particularly obscure compiler or platform) then boost.config has - a configure script.

-

Locale and traits class selection.

-

The following macros (see user.hpp) - control how boost.regex interacts with the users locale:

-

- - - - - - - - - - - - - -
BOOST_REGEX_USE_C_LOCALEForces boost.regex to use the global C locale in it's traits class support: - this is the default behaviour on non-windows platforms, but MS Windows - platforms normally use the Win32 API for locale support.
BOOST_REGEX_USE_CPP_LOCALEForces boost.regex to use std::locale in it's default traits class, regular - expressions can then be imbued with an instance specific locale.
BOOST_REGEX_NO_W32Tells boost.regex not to use any Win32 API's even when available (implies - BOOST_REGEX_USE_C_LOCALE unless BOOST_REGEX_USE_CPP_LOCALE is set).
-

-

Linkage Options

-

- - - - - - - - - -
BOOST_REGEX_STATIC_LINKFor Microsoft and Borland C++ builds, this tells boost.regex that it is going - to be linked to a static library even when using a dynamic C runtime.
BOOST_REGEX_NO_LIBFor Microsoft and Borland C++ builds, this tells boost.regex that it should - not automatically select the library to link to.
-

-

Algorithm Selection

-

- - - - - - - - - - - - - -
BOOST_REGEX_V3Tells boost.regex to use the boost-1.30.0 matching algorithm, define only if - you need maximum compatibility with previous behaviour.
BOOST_REGEX_RECURSIVETells boost.regex to use a stack-recursive matching algorithm.  This is - generally the fastest option (although there is very little in it), but can - cause stack overflow in extreme cases, on Win32 this can be handled safely, but - this is not the case on other platforms.
BOOST_REGEX_NON_RECURSIVETells boost.regex to use a non-stack recursive matching algorithm, this can be - slightly slower than the alternative, but is always safe no matter how - pathological the regular expression.  This is the default on non-Win32 - platforms.
-

-

Algorithm Tuning

-

The following option applies only if BOOST_REGEX_RECURSIVE is set.

-

- - - - - -
BOOST_REGEX_HAS_MS_STACK_GUARDTells boost.regex that Microsoft style __try - __except blocks are supported, - and can be used to safely trap stack overflow.
-

-

The following options apply only if BOOST_REGEX_NON_RECURSIVE is set.

-

- - - - - - - - - - - - - -
BOOST_REGEX_BLOCKSIZEIn non-recursive mode, boost.regex uses largish blocks of memory to act as a - stack for the state machine, the larger the block size then the fewer - allocations that will take place.  This defaults to 4096 bytes, which is - large enough to match the vast majority of regular expressions without - further allocations, however, you can choose smaller or larger values depending - upon your platforms characteristics.
BOOST_REGEX_MAX_BLOCKSTells boost.regex how many blocks of size BOOST_REGEX_BLOCKSIZE it is - permitted to use.  If this value is exceeded then boost.regex will stop - trying to find a match and throw a std::runtime_error.  Defaults to 1024, - don't forget to tweek this value if you alter BOOST_REGEX_BLOCKSIZE by much.
BOOST_REGEX_MAX_CACHE_BLOCKSTells boost.regex how many memory blocks to store in it's internal cache - - memory blocks are taken from this cache rather than by calling ::operator - new.  Generally speeking this can be an order of magnitude faster than - calling ::opertator new each time a memory block is required, but has the - downside that boost.regex can end up caching a large chunk of memory (by - default up to 16 blocks each of BOOST_REGEX_BLOCKSIZE size).  If memory is - tight then try defining this to 0 (disables all caching), or if that is too - slow, then a value of 1 or 2, may be sufficient.  On the other hand, on - large multi-processor, multi-threaded systems, you may find that a higher value - is in order.
-

-

-


-

-

Revised - - 11 April 2003 - -

-

© Copyright John Maddock 1998- 2003

-

Permission to use, copy, modify, distribute and sell this software - and its documentation for any purpose is hereby granted without fee, provided - that the above copyright notice appear in all copies and that both that - copyright notice and this permission notice appear in supporting documentation. - Dr John Maddock makes no representations about the suitability of this software - for any purpose. It is provided "as is" without express or implied warranty.

- + +Boost.Regex: Configuration and setup + + + + + +

+ + + + + + + +
+

+"C++

+
+

Boost.Regex

+ +

Configuration and setup

+
+

+"Boost.Regex

+
+ +
+
+ + +
+

Contents

+ +
+
Compiler setup + +
Locale and traits class selection + +
Linkage Options + +
Algorithm Selection + +
Algorithm Tuning
+
+ +

Compiler setup.

+ +

You shouldn't need to do anything special to configure +boost.regex for use with your compiler - the boost.config subsystem should already +take care of it, if you do have problems (or you are using a +particularly obscure compiler or platform) then boost.config has a configure script.

+ +

Locale and traits class selection.

+ +

The following macros (see user.hpp) control how +boost.regex interacts with the user's locale:

+ +

+ + + + + + + + + + + + + + + + +
BOOST_REGEX_USE_C_LOCALEForces boost.regex to use the global C locale in its traits +class support: this is the default behavior on non-windows +platforms, but MS Windows platforms normally use the Win32 API for +locale support.
BOOST_REGEX_USE_CPP_LOCALEForces boost.regex to use std::locale in it's default traits +class, regular expressions can then be imbued with an +instance specific locale.
BOOST_REGEX_NO_W32Tells boost.regex not to use any Win32 API's even when +available (implies BOOST_REGEX_USE_C_LOCALE unless +BOOST_REGEX_USE_CPP_LOCALE is set).
+ +
+
+ + +

Linkage Options

+ +

+ + + + + + + + + + + +
BOOST_REGEX_DYN_LINKFor Microsoft and Borland C++ builds, this tells + boost.regex that it should link to the dll build of the boost.regex.  By default +boost.regex will link to its static library build, even if the dynamic C runtime library +is in use.
BOOST_REGEX_NO_LIBFor Microsoft and Borland C++ builds, this tells boost.regex +that it should not automatically select the library to link +to.
+ +
+
+ + +

Algorithm Selection

+ +

+ + + + + + + + + + + + + + + + +
BOOST_REGEX_V3Tells boost.regex to use the boost-1.30.0 matching algorithm, +define only if you need maximum compatibility with previous +behavior.
BOOST_REGEX_RECURSIVETells boost.regex to use a stack-recursive matching +algorithm.  This is generally the fastest option (although +there is very little in it), but can cause stack overflow in +extreme cases, on Win32 this can be handled safely, but this is not +the case on other platforms.
BOOST_REGEX_NON_RECURSIVETells boost.regex to use a non-stack recursive matching +algorithm, this can be slightly slower than the alternative, but is +always safe no matter how pathological the regular +expression.  This is the default on non-Win32 platforms.
+ +
+
+ + +

Algorithm Tuning

+ +

The following option applies only if BOOST_REGEX_RECURSIVE is +set.

+ +

+ + + + + + +
BOOST_REGEX_HAS_MS_STACK_GUARDTells boost.regex that Microsoft style __try - __except blocks +are supported, and can be used to safely trap stack overflow.
+ +
+
+ + +

The following options apply only if BOOST_REGEX_NON_RECURSIVE is +set.

+ +

+ + + + + + + + + + + + + + + + +
BOOST_REGEX_BLOCKSIZEIn non-recursive mode, boost.regex uses largish blocks of +memory to act as a stack for the state machine, the larger the +block size then the fewer allocations that will take place.  +This defaults to 4096 bytes, which is large enough to match the +vast majority of regular expressions without further +allocations, however, you can choose smaller or larger values +depending upon your platforms characteristics.
BOOST_REGEX_MAX_BLOCKSTells boost.regex how many blocks of size BOOST_REGEX_BLOCKSIZE +it is permitted to use.  If this value is exceeded then +boost.regex will stop trying to find a match and throw a +std::runtime_error.  Defaults to 1024, don't forget to tweek +this value if you alter BOOST_REGEX_BLOCKSIZE by much.
BOOST_REGEX_MAX_CACHE_BLOCKSTells boost.regex how many memory blocks to store in it's +internal cache - memory blocks are taken from this cache rather +than by calling ::operator new.  Generally speeking this can +be an order of magnitude faster than calling ::opertator new each +time a memory block is required, but has the downside that +boost.regex can end up caching a large chunk of memory (by default +up to 16 blocks each of BOOST_REGEX_BLOCKSIZE size).  If +memory is tight then try defining this to 0 (disables all caching), +or if that is too slow, then a value of 1 or 2, may be +sufficient.  On the other hand, on large multi-processor, +multi-threaded systems, you may find that a higher value is in +order.
+ +
+
+ + +

+ +
+

Revised +11 +April 2003 +

+ +

© Copyright John +Maddock 1998- +2003 +

+ +

Permission to use, copy, modify, distribute and +sell this software and its documentation for any purpose is hereby +granted without fee, provided that the above copyright notice +appear in all copies and that both that copyright notice and this +permission notice appear in supporting documentation. Dr John +Maddock makes no representations about the suitability of this +software for any purpose. It is provided "as is" without express or +implied warranty.

+ diff --git a/doc/contacts.html b/doc/contacts.html index 1f256990..25038d8a 100644 --- a/doc/contacts.html +++ b/doc/contacts.html @@ -1,86 +1,111 @@ - - Boost.Regex: Contacts - - - - -

- - - - - - -
-

C++ Boost

-
-

Boost.Regex

-

Contacts and Acknowledgements

-
-

Boost.Regex Index

-
-

-
-

-

The author can be contacted at John_Maddock@compuserve.com, - the home page for this library is at - http://ourworld.compuserve.com/homepages/John_Maddock/regexpp.htm, and - the official boost version can be obtained from www.boost.org/libraries.htm. -

-

I am indebted to Robert Sedgewick's "Algorithms in C++" for forcing me to think - about algorithms and their performance, and to the folks at boost for forcing - me to think, period. The following people have all contributed useful - comments or fixes: Dave Abrahams, Mike Allison, Edan Ayal, Jayashree - Balasubramanian, Jan Bölsche, Beman Dawes, Paul Baxter, David Bergman, David - Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno, Tobias - Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick Hodapp, Jesse Jones, - Martin Jost, Boris Krasnovskiy, Jan Hermelink, Max Leung, Wei-hao Lin, Jens - Maurer, Richard Peters, Heiko Schmidt, Jason Shirk, Gerald Slacik, Scobie - Smith, Mike Smyth, Alexander Sokolovsky, Hervé Poirier, Michael Raykh, Marc - Recht, Scott VanCamp, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward, - Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to the manuals - supplied with the Henry Spencer, Perl and GNU regular expression libraries - - wherever possible I have tried to maintain compatibility with these libraries - and with the POSIX standard - the code however is entirely my own, including - any bugs! I can absolutely guarantee that I will not fix any bugs I don't know - about, so if you have any comments or spot any bugs, please get in touch. -

-

Useful further information can be found at: -

-

A short tutorial on regular expressions - can be found here.

-

The Open Unix - Specification contains a wealth of useful material, including the - regular expression syntax, and specifications for - <regex.h> and - <nl_types.h>. -

-

The Pattern Matching Pointers - site is a "must visit" resource for anyone interested in pattern matching. -

-

Glimpse and Agrep, use a - simplified regular expression syntax to achieve faster search times. -

-

Udi Manber and - Ricardo Baeza-Yates - both have a selection of useful pattern matching papers available from their - respective web sites. -

-


-

-

Revised - - 11 April 2003 - -

-

© Copyright John Maddock 1998- 2003

-

Permission to use, copy, modify, distribute and sell this software - and its documentation for any purpose is hereby granted without fee, provided - that the above copyright notice appear in all copies and that both that - copyright notice and this permission notice appear in supporting documentation. - Dr John Maddock makes no representations about the suitability of this software - for any purpose. It is provided "as is" without express or implied warranty.

- + +Boost.Regex: Contacts + + + + + +

+ + + + + + + +
+

+"C++

+
+

Boost.Regex

+ +

Contacts and Acknowledgements

+
+

+"Boost.Regex

+
+ +
+
+ + +
+

The author can be contacted at +john_maddock@compuserve.com, the home page for this library is +at +http://ourworld.compuserve.com/homepages/john_maddock/regexpp.htm, +and the official boost version can be obtained from www.boost.org/libraries.htm.

+ +

I am indebted to Robert Sedgewick's "Algorithms in C++" for +forcing me to think about algorithms and their performance, and to +the folks at boost for forcing me to think, period. The +following people have all contributed useful comments or fixes: +Dave Abrahams, Mike Allison, Edan Ayal, Jayashree Balasubramanian, +Jan Bölsche, Beman Dawes, Paul Baxter, David Bergman, David +Dennerline, Edward Diener, Peter Dimov, Robert Dunn, Fabio Forno, +Tobias Gabrielsson, Rob Gillen, Marc Gregoire, Chris Hecker, Nick +Hodapp, Jesse Jones, Martin Jost, Boris Krasnovskiy, Jan Hermelink, +Max Leung, Wei-hao Lin, Jens Maurer, Richard Peters, Heiko Schmidt, +Jason Shirk, Gerald Slacik, Scobie Smith, Mike Smyth, Alexander +Sokolovsky, Hervé Poirier, Michael Raykh, Marc Recht, Scott +VanCamp, Bruno Voigt, Alexey Voinov, Jerry Waldorf, Rob Ward, +Lealon Watts, Thomas Witt and Yuval Yosef. I am also grateful to +the manuals supplied with the Henry Spencer, Perl and GNU regular +expression libraries - wherever possible I have tried to maintain +compatibility with these libraries and with the POSIX standard - +the code however is entirely my own, including any bugs! I can +absolutely guarantee that I will not fix any bugs I don't know +about, so if you have any comments or spot any bugs, please get in +touch.

+ +

Useful further information can be found at:

+ +

A short tutorial on regular expressions can be +found here.

+ +

The Open Unix +Specification contains a wealth of useful material, including +the regular expression syntax, and specifications for +<regex.h> and +<nl_types.h>.

+ +

The Pattern +Matching Pointers site is a "must visit" resource for anyone +interested in pattern matching.

+ +

Glimpse and Agrep, +use a simplified regular expression syntax to achieve faster search +times.

+ +

Udi Manber +and Ricardo +Baeza-Yates both have a selection of useful pattern matching +papers available from their respective web sites.

+ +

+ +
+

Revised +11 +April 2003 +

+ +

© Copyright John +Maddock 1998- +2003 +

+ +

Permission to use, copy, modify, distribute and +sell this software and its documentation for any purpose is hereby +granted without fee, provided that the above copyright notice +appear in all copies and that both that copyright notice and this +permission notice appear in supporting documentation. Dr John +Maddock makes no representations about the suitability of this +software for any purpose. It is provided "as is" without express or +implied warranty.

+ diff --git a/doc/examples.html b/doc/examples.html index b8d61d2d..4e032d00 100644 --- a/doc/examples.html +++ b/doc/examples.html @@ -2,60 +2,51 @@ Boost.Regex: Examples + -

- - - - - - -
-

C++ Boost

-
-

Boost.Regex

-

Examples

-
-

Boost.Regex Index

-
-

-

+ + + + + + +
+

C++ Boost

+
+

Boost.Regex

+

Examples

+
+

Boost.Regex Index

+
+
+
+

There are three demo applications that ship with this library, they all come with makefiles for Borland, Microsoft and gcc compilers, otherwise you will - have to create your own makefiles. -

-
regress.exe: -
+ have to create your own makefiles.

+
regress.exe:

A regression test application that gives the matching/searching algorithms a full workout. The presence of this program is your guarantee that the library will behave as claimed - at least as far as those items tested are concerned - - if anyone spots anything that isn't being tested I'd be glad to hear about it. -

+ if anyone spots anything that isn't being tested I'd be glad to hear about it.

Files: parse.cpp, - regress.cpp, tests.cpp. -

-
jgrep.exe -
+ regress.cpp, tests.cpp.

+
jgrep.exe

A simple grep implementation, run with no command line options to find out its usage. Look at fileiter.cpp/fileiter.hpp and the mapfile class to see an example of a "smart" bidirectional iterator that - can be used with boost.regex or any other STL algorithm. -

+ can be used with boost.regex or any other STL algorithm.

Files: jgrep.cpp, - main.cpp. -

-
timer.exe -
+ main.cpp.

+
timer.exe

A simple interactive expression matching application, the results of all matches are timed, allowing the programmer to optimize their regular - expressions where performance is critical. -

-

Files: regex_timer.cpp. -

+ expressions where performance is critical.

+

Files: regex_timer.cpp.

Code snippets

The snippets examples contain the code examples used in the documentation:

credit_card_example.cpp: @@ -68,8 +59,7 @@ regex_grep example 1: searches a cpp file for class definitions.

regex_grep_example_2.cpp: regex_grep example 2: searches a cpp file for class definitions, using a global - callback function. -

+ callback function.

regex_grep_example_3.cpp: regex_grep example 2: searches a cpp file for class definitions, using a bound member function callback.

@@ -87,21 +77,23 @@

regex_split_example_1.cpp: regex_split example: split a string into tokens.

regex_split_example_2.cpp - : regex_split example: spit out linked URL's. -

-


+ : regex_split example: spit out linked URL's.

+

Revised - - 11 April 2003 - -

-

© Copyright John Maddock 1998- 2003

-

Permission to use, copy, modify, distribute and sell this software +11 +April 2003 +

+ +

© Copyright John +Maddock 1998- +2003 +

+

Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. Dr John Maddock makes no representations about the suitability of this software - for any purpose. It is provided "as is" without express or implied warranty.

+ for any purpose. It is provided "as is" without express or implied warranty.

diff --git a/doc/format_syntax.html b/doc/format_syntax.html index dc71d6d8..3aa628bb 100644 --- a/doc/format_syntax.html +++ b/doc/format_syntax.html @@ -28,7 +28,7 @@ regex_merge and by match_results::format, and are used to transform one string into another.

-

There are three kind of format string: sed, perl and extended, the extended +

There are three kind of format string: sed, Perl and extended, the extended syntax is a superset of the others so this is covered first.

Extended format syntax @@ -49,7 +49,7 @@
Sub-expression expansions:

-

The following perl like expressions expand to a particular matched +

The following Perl like expressions expand to a particular matched sub-expression:
  @@ -158,7 +158,7 @@

  \x{}A possible unicode hexadecimal character - for + A possible Unicode hexadecimal character - for example \x{1A0}  

-


-   -

-

Custom error messages are loaded as follows: -
-   +

Custom error messages are loaded as follows: 

@@ -929,12 +924,7 @@

-


-   -

-

Custom character class names are loaded as followed: -
-   +

Custom character class names are loaded as followed: 

@@ -1090,9 +1080,6 @@

-


-   -

Finally, custom collating element names are loaded starting from message id 400, and terminating when the first load thereafter fails. Each message looks something like: "tagname string" where tagname is the name used inside diff --git a/doc/match_results.html b/doc/match_results.html index 9a0d1afc..ac7889a9 100644 --- a/doc/match_results.html +++ b/doc/match_results.html @@ -134,13 +134,7 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,

Effects: Constructs an object of class match_results. The postconditions - of this function are indicated in Table RE16:

-
- Table RE16--match_results(const Allocator&) effects
-

-

-

-
+ of this function are indicated in the table:

@@ -182,7 +176,9 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,

-
match_results(const match_results& m);
+
+

 

+
match_results(const match_results& m);

Effects: Constructs an object of class match_results, as a copy of @@ -190,26 +186,22 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,

Effects: Assigns m to *this. The postconditions of this function are - indicated in Table RE17:

-
Table RE17--match_results(const Allocator&) effects
-

-

-

-

-

- - - - -
-

- Element -

-
-

- Value + indicated in the table:

+

+

+ + + + + + +
+

+ Element

-
+

+ Value

+

empty()

@@ -277,7 +269,7 @@ void swap(match_results<BidirectionalIterator, Allocator>& m1,

- +

match_results size

size_type size()const;
diff --git a/doc/partial_matches.html b/doc/partial_matches.html index 130c837d..4081ff98 100644 --- a/doc/partial_matches.html +++ b/doc/partial_matches.html @@ -40,7 +40,7 @@ by regex_match, regex_search or regex_grep):

- +
@@ -169,11 +169,11 @@ void search(std::istream& is)

Revised - + 11 April 2003

-

© Copyright John Maddock 1998- 2003

+

© Copyright John Maddock 1998- 2003

Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that diff --git a/doc/posix_api.html b/doc/posix_api.html index 89ae0a2f..2dd7a77e 100644 --- a/doc/posix_api.html +++ b/doc/posix_api.html @@ -158,8 +158,7 @@

- + @@ -277,7 +276,7 @@ 11 April 2003

-

© Copyright John Maddock 1998- 2003

+

© Copyright John Maddock 1998- 2003

Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that diff --git a/doc/regex_format.html b/doc/regex_format.html index 06de5621..9378debb 100644 --- a/doc/regex_format.html +++ b/doc/regex_format.html @@ -24,9 +24,9 @@


-

The algorithm regex_format is deprecated, new code should use +

The algorithm regex_format is deprecated; new code should use match_results::format instead.  Existing code will continue to compile, - the following documentation ius taken from the previous version of boost.regex + the following documentation is taken from the previous version of boost.regex and will not be further updated:

Algorithm regex_format

@@ -63,8 +63,6 @@ std::basic_string<charT> regex_format                                   const std::basic_string<charT>& fmt,                                   match_flag_type flags = 0);

Parameters to the main version of the function are passed as follows: -
-  

  Result
  REG_PERL  A shortcut for perl-like behavior: REG_EXTENDED - | REG_NOCOLLATE | REG_ESCAPE_IN_LISTSCompiles Perl like regular expressions.  
@@ -100,8 +98,6 @@ std::basic_string<charT> regex_format

Format flags are defined as follows: -
-  

@@ -140,9 +136,6 @@ std::basic_string<charT> regex_format

-


-   -

The format string syntax (and available options) is described more fully under format strings . @@ -154,7 +147,7 @@ std::basic_string<charT> regex_format 11 April 2003

-

© Copyright John Maddock 1998- 2003

+

© Copyright John Maddock 1998- 2003

Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that diff --git a/doc/regex_grep.html b/doc/regex_grep.html index 131f7c84..9ba7475f 100644 --- a/doc/regex_grep.html +++ b/doc/regex_grep.html @@ -24,7 +24,7 @@


-

The algorithm regex_grep is deprecated in favour of regex_iterator +

The algorithm regex_grep is deprecated in favor of regex_iterator which provides a more convenient and standard library friendly interface.

The following documentation is taken unchanged from the previous boost release, and will not be updated in future.

@@ -57,9 +57,7 @@               const basic_regex<charT, traits, Allocator>& e,                unsigned flags = match_default);

The parameters for the primary version of regex_grep have the following - meanings: -
-   + meanings: 

@@ -97,8 +95,8 @@

-

 The algorithm finds all of the non-overlapping matches of the expression - e, for each match it fills a match_results<iterator, +

The algorithm finds all of the non-overlapping matches of the expression e, for + each match it fills a match_results<iterator, Allocator> structure, which contains information on what matched, and calls the predicate foo, passing the match_results<iterator, Allocator> as a single argument. If the predicate returns true, then the grep operation @@ -364,11 +362,11 @@ index[std::string(what[5].first, what[5].second) + std::string(what[6].first, wh


Revised - + 11 April 2003

-

© Copyright John Maddock 1998- 2003

+

© Copyright John Maddock 1998- 2003

Permission to use, copy, modify, distribute and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that diff --git a/doc/regex_iterator.html b/doc/regex_iterator.html index 95376f4a..14cc7a24 100644 --- a/doc/regex_iterator.html +++ b/doc/regex_iterator.html @@ -62,7 +62,7 @@ public:

Description

A regex_iterator is constructed from a pair of iterators, and enumerates all - occurances of a regular expression within that iterator range.

+ occurrences of a regular expression within that iterator range.

regex_iterator();

@@ -71,7 +71,7 @@ public: match_flag_type m = match_default);

- Effects: constructs a regex_iterator that will enumerate all occurances + Effects: constructs a regex_iterator that will enumerate all occurrences of the expression re, within the sequence [a,b), and found using match flags m.  The object re must exist for the lifetime of the regex_iterator.

regex_iterator(const regex_iterator& that);
@@ -93,11 +93,10 @@ public: Effects:
returns !(*this == that).

RE.8.1.1 regex_iterator dereference
const value_type& operator*();
- -

- Effects: dereferencing a regex_iterator object it yields a - const reference to a match_results object, - whose members are set as follows:

+

+ Effects: dereferencing a regex_iterator object it yields a + const reference to a match_results object, + whose members are set as follows:

@@ -196,9 +195,9 @@ public: - @@ -229,7 +228,6 @@ public: diff --git a/example/Jamfile b/example/Jamfile index b4979bfa..1392b2f8 100644 --- a/example/Jamfile +++ b/example/Jamfile @@ -41,9 +41,11 @@ test-suite regex-examples : [ regex-test-run snippets/regex_replace_example.cpp : $(BOOST_ROOT)/boost/rational.hpp ] [ regex-test-run snippets/regex_search_example.cpp : $(BOOST_ROOT)/boost/rational.hpp ] [ regex-test-run snippets/regex_split_example_1.cpp : -auto ] -[ regex-test-run snippets/regex_split_example_2.cpp : $(BOOST_ROOT)/libs/regex/index.htm ] +[ regex-test-run snippets/regex_split_example_2.cpp : $(BOOST_ROOT)/libs/regex/doc/index.html ] ; + + diff --git a/performance/command_line.cpp b/performance/command_line.cpp index 7e502154..b74143c3 100644 --- a/performance/command_line.cpp +++ b/performance/command_line.cpp @@ -10,6 +10,10 @@ #include #include "regex_comparison.hpp" +#ifdef BOOST_HAS_PCRE +#include "pcre.h" // for pcre version number +#endif + // // globals: // @@ -32,6 +36,20 @@ std::string html_out_file; std::string html_contents; std::list result_list; +// the following let us compute averages: +double greta_total = 0; +double safe_greta_total = 0; +double boost_total = 0; +double locale_boost_total = 0; +double posix_total = 0; +double pcre_total = 0; +unsigned greta_test_count = 0; +unsigned safe_greta_test_count = 0; +unsigned boost_test_count = 0; +unsigned locale_boost_test_count = 0; +unsigned posix_test_count = 0; +unsigned pcre_test_count = 0; + int handle_argument(const std::string& what) { if(what == "-b") @@ -196,7 +214,7 @@ std::string html_quote(const std::string& in) { static const boost::regex e("(<)|(>)|(&)|(\")"); static const std::string format("(?1<)(?2>)(?3&)(?4")"); - return regex_replace(in, e, format); + return regex_replace(in, e, format, boost::match_default | boost::format_all); } void output_html_results(bool show_description, const std::string& tagname) @@ -244,21 +262,63 @@ void output_html_results(bool show_description, const std::string& tagname) os << ""; #if defined(BOOST_HAS_GRETA) if(time_greta == true) + { print_result(os, first->greta_time, first->factor); + if(first->greta_time > 0) + { + greta_total += first->greta_time / first->factor; + ++greta_test_count; + } + } if(time_safe_greta == true) + { print_result(os, first->safe_greta_time, first->factor); + if(first->safe_greta_time > 0) + { + safe_greta_total += first->safe_greta_time / first->factor; + ++safe_greta_test_count; + } + } #endif #if defined(BOOST_HAS_POSIX) if(time_boost == true) + { print_result(os, first->boost_time, first->factor); + if(first->boost_time > 0) + { + boost_total += first->boost_time / first->factor; + ++boost_test_count; + } + } if(time_localised_boost == true) + { print_result(os, first->localised_boost_time, first->factor); + if(first->localised_boost_time > 0) + { + locale_boost_total += first->localised_boost_time / first->factor; + ++locale_boost_test_count; + } + } #endif if(time_posix == true) + { print_result(os, first->posix_time, first->factor); + if(first->posix_time > 0) + { + posix_total += first->posix_time / first->factor; + ++posix_test_count; + } + } #if defined(BOOST_HAS_PCRE) if(time_pcre == true) + { print_result(os, first->pcre_time, first->factor); + if(first->pcre_time > 0) + { + pcre_total += first->pcre_time / first->factor; + ++pcre_test_count; + } + } #endif os << "\n"; ++first; @@ -280,6 +340,81 @@ void output_html_results(bool show_description, const std::string& tagname) } } +std::string get_boost_version() +{ + std::stringstream os; + os << (BOOST_VERSION / 100000) << '.' << ((BOOST_VERSION / 100) % 1000) << '.' << (BOOST_VERSION % 100); + return os.str(); +} + +std::string get_averages_table() +{ + std::stringstream os; + // + // start by outputting the table header: + // + os << "

(*it)[0].matched

+

- true if a full match was found, and false if it was a + true if a full match was found, and false if it was a partial match (found as a result of the match_partial flag being set).

For all integers n < (*it).size(), true if sub-expression n participated in the match, false otherwise.

-

(*it).position(n)" << html_quote(first->description) << "
\n"; + os << ""; +#if defined(BOOST_HAS_GRETA) + if(time_greta == true) + { + os << ""; + } + if(time_safe_greta == true) + { + os << ""; + } + +#endif + if(time_boost == true) + { + os << ""; + } + if(time_localised_boost == true) + { + os << ""; + } +#if defined(BOOST_HAS_POSIX) + if(time_posix == true) + { + os << ""; + } +#endif +#ifdef BOOST_HAS_PCRE + if(time_pcre == true) + { + os << ""; + } +#endif + os << "\n"; + + // + // Now enumerate through all averages: + // + os << ""; +#if defined(BOOST_HAS_GRETA) + if(time_greta == true) + os << "\n"; + if(time_safe_greta == true) + os << "\n"; +#endif +#if defined(BOOST_HAS_POSIX) + if(time_boost == true) + os << "\n"; + if(time_localised_boost == true) + os << "\n"; +#endif + if(time_posix == true) + os << "\n"; +#if defined(BOOST_HAS_PCRE) + if(time_pcre == true) + os << "\n"; +#endif + os << "\n"; + os << "
GRETAGRETA
(non-recursive mode)
BoostBoost + C++ localePOSIXPCRE
" << (greta_total / greta_test_count) << "" << (safe_greta_total / safe_greta_test_count) << "" << (boost_total / boost_test_count) << "" << (locale_boost_total / locale_boost_test_count) << "" << (posix_total / posix_test_count) << "" << (pcre_total / pcre_test_count) << "
\n"; + return os.str(); +} + void output_final_html() { if(html_out_file.size()) @@ -306,7 +441,7 @@ void output_final_html() pos = html_contents.find("%boost%"); if(pos != std::string::npos) { - html_contents.replace(pos, 7, BOOST_STRINGIZE(BOOST_VERSION)); + html_contents.replace(pos, 7, get_boost_version()); } pos = html_contents.find("%pcre%"); if(pos != std::string::npos) @@ -317,7 +452,12 @@ void output_final_html() html_contents.replace(pos, 6, "N/A"); #endif } - // + pos = html_contents.find("%averages%"); + if(pos != std::string::npos) + { + html_contents.replace(pos, 10, get_averages_table()); + } + // // now right the output to file: // std::ofstream os(html_out_file.c_str()); diff --git a/performance/input.html b/performance/input.html index f44bcfce..85ca5dba 100644 --- a/performance/input.html +++ b/performance/input.html @@ -8,13 +8,14 @@

Regular Expression Performance Comparison

-

The Boost and GRETA regular expression libraries have slightly different - interfaces, and it has been suggested that GRETA's interface allows for a more - efficient implementation. The following tables provide comparisons between:

+

+ The following tables provide comparisons between the following regular + expression libraries:

GRETA.

The Boost regex library.

Henry Spencer's regular expression library - this is provided for comparison as a typical non-backtracking implementation.

+

Philip Hazel's PCRE library.

Details

Machine: Intel Pentium 4 2.8GHz PC.

Compiler: %compiler%.

@@ -30,6 +31,11 @@ performance of these libraries can be expected on other machines - as memory access and processor caching effects can be quite large for most finite state machine algorithms.

+

Averages

+

The following are the average relative scores for all the tests: the perfect + regular expression library would score 1, in practice anything less than 2 + is pretty good.

+

%averages%

Comparison 1: Long Search

For each of the following regular expressions the time taken to find all occurrences of the expression within a long English language text was measured diff --git a/src/cpp_regex_traits.cpp b/src/cpp_regex_traits.cpp index 0b81974c..cdb97a31 100644 --- a/src/cpp_regex_traits.cpp +++ b/src/cpp_regex_traits.cpp @@ -254,8 +254,9 @@ message_data::message_data(const std::locale& l, const std::string& regex_ // STLport users as well (gcc3.1+STLport5), so enable the // workaround for all STLport users... // -#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) +#if (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) && !defined(BOOST_MSVC) using namespace std; + using stlport::isspace; # define BOOST_REGEX_STD #else # define BOOST_REGEX_STD std:: diff --git a/test/Jamfile b/test/Jamfile index 7dc873a7..f1c809ea 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -58,6 +58,18 @@ test-suite regex c_compiler_checks/wide_posix_api_check.cpp ] + [ regex-test bad_expression_test + :