From 515044821c73d0d10c97df23f7e939501a81fe95 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Tue, 21 Oct 2003 11:18:40 +0000 Subject: [PATCH] Updated docs to include recent changes, and improve general quality. [SVN r20443] --- doc/Attic/basic_regex.html | 1785 +++++++++++---------------- doc/Attic/contacts.html | 189 ++- doc/Attic/history.html | 16 +- doc/Attic/introduction.html | 37 +- doc/Attic/match_flag_type.html | 538 ++++---- doc/Attic/match_results.html | 752 +++++------ doc/Attic/redistributables.html | 17 +- doc/Attic/regex_iterator.html | 69 +- doc/Attic/regex_match.html | 46 +- doc/Attic/regex_replace.html | 94 +- doc/Attic/regex_search.html | 24 +- doc/Attic/regex_token_iterator.html | 52 +- doc/Attic/sub_match.html | 472 ++++--- doc/Attic/thread_safety.html | 6 +- doc/basic_regex.html | 1785 +++++++++++---------------- doc/contacts.html | 189 ++- doc/history.html | 16 +- doc/introduction.html | 37 +- doc/match_flag_type.html | 538 ++++---- doc/match_results.html | 752 +++++------ doc/redistributables.html | 17 +- doc/regex_iterator.html | 69 +- doc/regex_match.html | 46 +- doc/regex_replace.html | 94 +- doc/regex_search.html | 24 +- doc/regex_token_iterator.html | 52 +- doc/sub_match.html | 472 ++++--- doc/thread_safety.html | 6 +- 28 files changed, 3764 insertions(+), 4430 deletions(-) diff --git a/doc/Attic/basic_regex.html b/doc/Attic/basic_regex.html index 5108c248..1c18ab6d 100644 --- a/doc/Attic/basic_regex.html +++ b/doc/Attic/basic_regex.html @@ -1,64 +1,46 @@ - -Boost.Regex: basic_regex - - - - - - - - - - - -
-

-"C++

-
-

Boost.Regex

- -

basic_regex

-
-

-"Boost.Regex

-
- -
-
- - -
-

Synopsis

- -
+   
+      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 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 instances, unless you want to use -custom traits classes or allocators, you won't need to use anything -other than these:

- -
+      

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 + 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 basic_regex;
@@ -66,12 +48,9 @@ other than these:

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.

- -
+      

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,
@@ -112,89 +91,86 @@ public:
    static const regex_constants::syntax_option_type perl = regex_constants::perl;
 
    // construct/copy/destroy:
-   explicit basic_regex(const Allocator& a = Allocator());
-   explicit basic_regex(const charT* p, flag_type f = regex_constants::normal,
+   explicit basic_regex(const Allocator& a = Allocator());
+   explicit basic_regex(const charT* p, flag_type f = regex_constants::normal,
                         const Allocator& a = Allocator());
-   basic_regex(const charT* p1, const charT* p2, flag_type f = regex_constants::normal,
+   basic_regex(const charT* p1, const charT* p2, flag_type f = regex_constants::normal,
                const Allocator& a = Allocator());
-   basic_regex(const charT* p, size_type len, flag_type f,
+   basic_regex(const charT* p, size_type len, flag_type f,
                const Allocator& a = Allocator());
-   basic_regex(const basic_regex&);
+   basic_regex(const basic_regex&);
    template <class ST, class SA>
-   explicit basic_regex(const basic_string<charT, ST, SA>& p,
+   explicit basic_regex(const basic_string<charT, ST, SA>& p,
                         flag_type f = regex_constants::normal,
                         const Allocator& a = Allocator());
    template <class InputIterator>
-   basic_regex(InputIterator first, inputIterator last,
+   basic_regex(InputIterator first, inputIterator last,
                flag_type f = regex_constants::normal,
                const Allocator& a = Allocator());
 
    ~basic_regex();
-   basic_regex& operator=(const basic_regex&);
-   basic_regex& operator=(const charT* ptr);
-   template <class ST, class SA>
-   basic_regex& operator=(const basic_string<charT, ST, SA>& p);
-
-   // iterators:
-   const_iterator begin() const;
-   const_iterator end() const;
-   // capacity:
-   size_type size() const;
-   size_type max_size() const;
-   bool empty() const;
-   unsigned mark_count() const;
-
+   basic_regex& operator=(const basic_regex&);
+   basic_regex& operator= (const charT* ptr); 
+   template <class ST, class SA> 
+   basic_regex& operator= (const basic_string<charT, ST, SA>& p);
+   // iterators: 
+   const_iterator begin() const; 
+   const_iterator end() const;
+   // capacity: 
+   size_type size() const; 
+   size_type max_size() const; 
+   bool empty() const; 
+   unsigned mark_count()const; 
    //
-   // modifiers:
-   basic_regex& assign(const basic_regex& that);
-   basic_regex& assign(const charT* ptr, flag_type f = regex_constants::normal);
-   basic_regex& assign(const charT* first, const charT* last,
-                       flag_type f = regex_constants::normal);
+   // modifiers: 
+   basic_regex& assign(const basic_regex& that); 
+   basic_regex& assign(const charT* ptr, flag_type f = regex_constants::normal);
+   basic_regex& assign(const charT* ptr, unsigned int len, flag_type f);
    template <class string_traits, class A>
-   basic_regex& assign(const basic_string<charT, string_traits, A>& s,
+   basic_regex& assign(const basic_string<charT, string_traits, A>& s,
                        flag_type f = regex_constants::normal);
    template <class InputIterator>
-   basic_regex& assign(InputIterator first, InputIterator last,
+   basic_regex& assign(InputIterator first, InputIterator last,
                        flag_type f = regex_constants::normal);
 
    // const operations:
-   Allocator get_allocator() const;
-   flag_type getflags() const;
-   basic_string<charT> str() const;
-   int compare(basic_regex&) const;
+   Allocator get_allocator() const;
+   flag_type flags() const;
+   basic_string<charT> str() const;
+   int compare(basic_regex&) const;
    // locale:
-   locale_type imbue(locale_type loc);
-   locale_type getloc() const;
+   locale_type imbue(locale_type loc);
+   locale_type getloc() const;
    // swap
-   void swap(basic_regex&) throw();
+   void swap(basic_regex&) throw();
 };
 
 template <class charT, class traits, class Allocator>
-bool operator == (const basic_regex<charT, traits, Allocator>& lhs,
+bool operator == (const basic_regex<charT, traits, Allocator>& lhs,
                   const basic_regex<charT, traits, Allocator>& rhs);
 template <class charT, class traits, class Allocator>
-bool operator != (const basic_regex<charT, traits, Allocator>& lhs,
+bool operator != (const basic_regex<charT, traits, Allocator>& lhs,
                   const basic_regex<charT, traits, Allocator>& rhs);
 template <class charT, class traits, class Allocator>
-bool operator < (const basic_regex<charT, traits, Allocator>& lhs,
+bool operator < (const basic_regex<charT, traits, Allocator>& lhs,
                  const basic_regex<charT, traits, Allocator>& rhs);
 template <class charT, class traits, class Allocator>
-bool operator <= (const basic_regex<charT, traits, Allocator>& lhs,
+bool operator <= (const basic_regex<charT, traits, Allocator>& lhs,
                   const basic_regex<charT, traits, Allocator>& rhs);
 template <class charT, class traits, class Allocator>
-bool operator >= (const basic_regex<charT, traits, Allocator>& lhs,
+bool operator >= (const basic_regex<charT, traits, Allocator>& lhs,
                   const basic_regex<charT, traits, Allocator>& rhs);
 template <class charT, class traits, class Allocator>
-bool operator > (const basic_regex<charT, traits, Allocator>& lhs,
+bool operator > (const basic_regex<charT, traits, Allocator>& lhs,
                  const basic_regex<charT, traits, Allocator>& rhs);
 
 template <class charT, class io_traits, class re_traits, class Allocator>
 basic_ostream<charT, io_traits>&
-   operator << (basic_ostream<charT, io_traits>& os,
+   operator << (basic_ostream<charT, io_traits>& os,
                 const basic_regex<charT, re_traits, Allocator>& e);
 
 template <class charT, class traits, class Allocator>
-void swap(basic_regex<charT, traits, Allocator>& e1,
+void swap(basic_regex<charT, traits, Allocator>& e1,
           basic_regex<charT, traits, Allocator>& e2);
 
 typedef basic_regex<char> regex;
@@ -202,15 +178,10 @@ typedef basic_regex<wchar_t> wregex;
 
 } // namespace boost
 
- -

Description

- -

Class basic_regex has the following public member -functions:

- -

basic_regex constants

- -
+      

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;
@@ -227,1067 +198,721 @@ 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 argument is used for any memory allocation -performed by the constructor or member functions during the -lifetime of the object.

- -
+      

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

-
-
-
- -
+      

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

-
-
-
- -
+      

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)

+
+

flags()

+
+

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

+
+

flags()

+
+

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.

-
-
-
- -
+      

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)

+
+

flags()

+
+

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

-
-
-
- -
+      

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

+
+

flags()

+
+

e.flags()

+
+

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.

-
-
-
- -
+      

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

+
+

flags()

+
+

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.

-
-
-
- -
+      

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)

+
+

flags()

+
+

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

- -
+      

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

+

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

Requires: p shall not be a null pointer.

- - - -

Effects: Returns the result of -assign(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

- -
+      

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.

- -
+      

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

- -
+      

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.

- -
+      

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.

- -
+      

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

- -
+      

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

- -
+      

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

+

 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,
+      

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

+
basic_regex& assign(const charT* ptr, unsigned int len, flag_type f);
+

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

+
template <class string_traits, class A>
+basic_regex& assign(const basic_string<charT, string_traits, A>& s,
                     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.

-
-
-
- -
+
+

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

+
+

flags()

+
+

f

+
+

mark_count()

+
+

The number of marked sub-expressions within the expression.

+
+
+
+
  
 
- -
-template <class InputIterator>
+      
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;
+      

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 Allocator that was passed to the object's + constructor.

+
flag_type flags() 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 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: 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: If flags() == e.flags() then returns str().compare(e.str()), + otherwise returns flags() - e.flags().

+

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.

- -
+      

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

- -
+      

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 
- -
+      

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 
+

Comparisons between basic_regex objects are provided on an experimental basis: + please note that these are likely to be removed from the standard library + proposal, so use with care if you are writing portable code.

+

 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.

- -
+      

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.

- -
+      

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.

- -
+      

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.

- -
+      

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.

- -
+      

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.
- -
+      

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

+
basic_regex inserter.
+

The basic_regex stream inserter is provided on an experimental basis, and + outputs the textual representation of the expression to the stream:

+

 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
- -
+      

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

- -
-

Revised - -17 May 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.

- +

Effects: calls lhs.swap(rhs).

+
+

Revised + + 17 May 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 2f12281e..e24e93ac 100644 --- a/doc/Attic/contacts.html +++ b/doc/Attic/contacts.html @@ -1,110 +1,85 @@ - -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 -17 May 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

+
+

Boost.Regex

+

Contacts and Acknowledgements

+
+

Boost.Regex Index

+
+
+
+
+

The author can be contacted at john@johnmaddock.co.uk; the + home page for this library is at www.boost.org.

+

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:

+

Short tutorials on regular expressions can be + found here and here.

+

The main book on regular expressions is + Mastering Regular Expressions, published by O'Reilly.

+

Information on the + Boost.regex standardization proposal, along with other + standard library extension proposals can be found on the + C++ Committees web pages.

+

TheOpen 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 + + 17 May 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/history.html b/doc/Attic/history.html index 17ca695c..36eb7ac7 100644 --- a/doc/Attic/history.html +++ b/doc/Attic/history.html @@ -27,17 +27,20 @@

Boost 1.31.0.

  • - Completely rewritten pattern matching code - it is now up to 10 times faster - than before.
  • + Completely rewritten pattern matching code - it is now up to 10 times faster + than before.
  • - Reorganized documentation.
  • + Reorganized documentation.
  • Deprecated all interfaces that are not part of the - regular expression standardization proposal.
  • + regular expression standardization proposal.
  • - Added regex_iterator and regex_token_iterator.
  • + Added regex_iterator and regex_token_iterator.
  • - Added support for Perl style independent sub-expressions.
+ Added support for Perl style independent sub-expressions. +
  • + Added non-member operators to the sub_match class, so that you can compare + sub_match's with strings, or add them to a string to produce a new string.

  • @@ -55,4 +58,3 @@ for any purpose. It is provided "as is" without express or implied warranty.

    - diff --git a/doc/Attic/introduction.html b/doc/Attic/introduction.html index cd00847a..1e48bf9e 100644 --- a/doc/Attic/introduction.html +++ b/doc/Attic/introduction.html @@ -62,7 +62,7 @@ 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}

    +
    (\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++ @@ -93,8 +93,9 @@ 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 - algorithm regex_replace, for our credit card example we can write two algorithms - like this to provide the format conversions:

    + algorithm regex_replace, for our credit card + example we can write two algorithms like this to provide the format + conversions:

    // match any format with the regular expression:
     const boost::regex e("\\A(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})\\z");
     const std::string machine_format("\\1\\2\\3\\4");
    @@ -126,22 +127,31 @@ std::string human_readable_card_number(const std::string s)
     typedef match_results<std::string::const_iterator> smatch;
     typedef match_results<std::wstring::const_iterator> wsmatch; 
     }
    -

    The algorithms regex_search and - regex_grep (i.e. finding all matches in a string) make use of - match_results to report what matched.

    +

    The algorithms regex_search and regex_match + make use of match_results to report what matched; the difference between these + algorithms is that regex_match will only find + matches that consume all of the input text, where as + regex_search will search for a match anywhere within the text + being matched.

    Note that these algorithms are not restricted to searching regular C-strings, any bidirectional iterator type can be searched, allowing for the possibility of seamlessly searching almost any kind of data.

    -

    For search and replace operations in addition to the algorithm - regex_replace that we have already seen, the algorithm - regex_format takes the result of a match and a format string, and - produces a new string by merging the two.

    +

    For search and replace operations, in addition to the algorithm + regex_replace that we have already seen, the match_results + class has a format member that takes the result of a match and a format string, + and produces a new string by merging the two.

    +

    For iterating through all occurences of an expression within a text, there are + two iterator types: regex_iterator will + enumerate over the match_results objects + found, while regex_token_iterator will + enumerate a series of strings (similar to perl style split operations).

    For those that dislike templates, there is a high level wrapper class RegEx that is an encapsulation of the lower level template code - it provides a simplified interface for those that don't need the full power of the library, and supports only narrow characters, and the "extended" regular expression - syntax. + syntax. This class is now deprecated as it does not form part of the regular + expressions C++ standard library proposal.

    The POSIX API functions: regcomp, regexec, regfree and regerror, are available in both narrow character and Unicode versions, and @@ -162,7 +172,7 @@ std::string human_readable_card_number(const std::string s) 17 May 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 @@ -171,6 +181,3 @@ std::string human_readable_card_number(const std::string s) for any purpose. It is provided "as is" without express or implied warranty.

    - - - diff --git a/doc/Attic/match_flag_type.html b/doc/Attic/match_flag_type.html index 0e89736a..3e5b3485 100644 --- a/doc/Attic/match_flag_type.html +++ b/doc/Attic/match_flag_type.html @@ -1,46 +1,36 @@ - - -Boost.Regex: match_flag_type - - - - -

    - - - - - - - -
    -

    -"C++

    -
    -

    Boost.Regex

    - -

    match_flag_type

    -
    -

    -"Boost.Regex

    -
    - -
    -
    - - -
    -

    Synopsis

    - -

    The type match_flag_type is an implementation -defined bitmask type (17.3.2.1.2) that controls how a regular -expression is matched against a character sequence.

    - -
    +   
    +      Boost.Regex: match_flag_type
    +      
    +      
    +      
    +   
    +   
    +      

    + + + + + + +
    +

    C++ Boost

    +
    +

    Boost.Regex

    +

    match_flag_type

    +
    +

    Boost.Regex Index

    +
    +
    +
    +
    +

    Synopsis

    +

    The type match_flag_type is an implementation defined bitmask type + (17.3.2.1.2) that controls how a regular expression is matched against a + character sequence.  The behavior of the format flags is descibed in more + detail in the format syntax guide.

    +
     namespace std{ namespace regex_constants{
     
     typedef bitmask_type match_flag_type;
    @@ -70,261 +60,213 @@ static const match_flag_type format_all;
     } // namespace regex_constants
     } // namespace std
     
    - -

    Description

    - -

    The type match_flag_type is an implementation -defined bitmask type (17.3.2.1.2). When matching a regular -expression against a sequence of characters [first, last) then -setting its elements has the effects listed in the table below:

    - -

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

    Element

    -
    -

    Effect if set

    -
    -

    match_default

    -
    -

    Specifies that matching of regular expressions proceeds without -any modification of the normal rules used in ECMA-262, ECMAScript -Language Specification, Chapter 15 part 10, RegExp (Regular -Expression) Objects (FWD.1)

    -
    match_not_bobSpecifies that the expression "\A" -should not match against the sub-sequence [first,first).
    match_not_eobSpecifies that the expressions "\z" -and "\Z" should not match against the sub-sequence -[last,last).
    -

    match_not_bol

    -
    -

    Specifies that the expression "^" should not be matched against -the sub-sequence [first,first).

    -
    -

    match_not_eol

    -
    -

    Specifies that the expression "$" should not be matched against -the sub-sequence [last,last).

    -
    -

    match_not_bow

    -
    -

    Specifies that the expression "\b" should not be matched against -the sub-sequence [first,first).

    -
    -

    match_not_eow

    -
    -

    Specifies that the expression "\b" should not be matched against -the sub-sequence [last,last).

    -
    -

    match_any

    -
    -

    Specifies that if more than one match is possible then any match -is an acceptable result.

    -
    -

    match_not_null

    -
    -

    Specifies that the expression can not be matched against an -empty sequence.

    -
    -

    match_continuous

    -
    -

    Specifies that the expression must match a sub-sequence that -begins at first.

    -
    -

    match_partial

    -
    -

    Specifies that if no match can be found, then it is acceptable -to return a match [from, last) where from!=last, if there exists -some sequence of characters [from,to) of which [from,last) is a -prefix, and which would result in a full match.

    -
    -

    match_prev_avail

    -
    -

    Specifies that --first is a valid iterator -position, when this flag is set then the flags -match_not_bol and match_not_bow are ignored by -the regular expression algorithms (RE.7) and iterators (RE.8).

    -
    match_not_dot_newlineSpecifies that the expression "." does -not match a newline character.
    match_not_dot_nullSpecified that the expression "." does -not match a character null '\0'.
    -

    format_default

    -
    -

    Specifies that when a regular expression match is to be replaced -by a new string, that the new string is constructed using the rules -used by the ECMAScript replace function in ECMA-262, ECMAScript -Language Specification, Chapter 15 part 5.4.11 -String.prototype.replace. (FWD.1). In addition during search and -replace operations then all non-overlapping occurrences of the -regular expression are located and replaced, and sections of the -input that did not match the expression, are copied unchanged to -the output string.

    -
    -

    format_sed

    -
    -

    Specifies that when a regular expression match is to be replaced -by a new string, that the new string is constructed using the rules -used by the Unix sed utility in IEEE Std 1003.1-2001, Portable -Operating SystemInterface (POSIX ), Shells and Utilities..

    -
    -

    format_perl

    -
    -

    Specifies that when a regular expression match is to be replaced -by a new string, that the new string is constructed using an -implementation defined superset of the rules used by the ECMAScript -replace function in ECMA-262, ECMAScript Language Specification, -Chapter 15 part 5.4.11 String.prototype.replace (FWD.1).

    -
    format_allSpecifies that all syntax -extensions are enabled, including conditional -(?ddexpression1:expression2) replacements.
    -

    format_no_copy

    -
    -

    When specified during a search and replace operation, then -sections of the character container sequence being searched that do -match the regular expression, are not copied to the output -string.

    -
    -

    format_first_only

    -
    -

    When specified during a search and replace operation, then only -the first occurrence of the regular expression is replaced.

    -
    - -
    -
    - - -

    - -
    -
    -
    - - -

    Revised - -17 May 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.

    - +

    Description

    +

    The type match_flag_type is an implementation defined bitmask type + (17.3.2.1.2). When matching a regular expression against a sequence of + characters [first, last) then setting its elements has the effects listed in + the table below:

    +

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

    Element

    +
    +

    Effect if set

    +
    +

    match_default

    +
    +

    Specifies that matching of regular expressions proceeds without any + modification of the normal rules used in ECMA-262, ECMAScript Language + Specification, Chapter 15 part 10, RegExp (Regular Expression) Objects (FWD.1)

    +
    match_not_bobSpecifies that the expression "\A" should not match + against the sub-sequence [first,first).
    match_not_eobSpecifies that the expressions "\z" and + "\Z" should not match against the sub-sequence [last,last).
    +

    match_not_bol

    +
    +

    Specifies that the expression "^" should not be matched against the + sub-sequence [first,first).

    +
    +

    match_not_eol

    +
    +

    Specifies that the expression "$" should not be matched against the + sub-sequence [last,last).

    +
    +

    match_not_bow

    +
    +

    Specifies that the expression "\b" should not be matched against the + sub-sequence [first,first).

    +
    +

    match_not_eow

    +
    +

    Specifies that the expression "\b" should not be matched against the + sub-sequence [last,last).

    +
    +

    match_any

    +
    +

    Specifies that if more than one match is possible then any match is an + acceptable result.

    +
    +

    match_not_null

    +
    +

    Specifies that the expression can not be matched against an empty sequence.

    +
    +

    match_continuous

    +
    +

    Specifies that the expression must match a sub-sequence that begins at first.

    +
    +

    match_partial

    +
    +

    Specifies that if no match can be found, then it is acceptable to return a + match [from, last) where from!=last, if there exists some sequence of + characters [from,to) of which [from,last) is a prefix, and which would result + in a full match.

    +
    +

    match_prev_avail

    +
    +

    Specifies that --first is a valid iterator position, when this + flag is set then the flags match_not_bol and match_not_bow + are ignored by the regular expression algorithms (RE.7) and iterators (RE.8).

    +
    match_not_dot_newlineSpecifies that the expression "." does not match a + newline character.
    match_not_dot_nullSpecified that the expression "." does not match a + character null '\0'.
    +

    format_default

    +
    +

    Specifies that when a regular expression match is to be replaced by a new + string, that the new string is constructed using the rules used by the + ECMAScript replace function in ECMA-262, ECMAScript Language Specification, + Chapter 15 part 5.4.11 String.prototype.replace. (FWD.1). In addition during + search and replace operations then all non-overlapping occurrences of the + regular expression are located and replaced, and sections of the input that did + not match the expression, are copied unchanged to the output string.

    +
    +

    format_sed

    +
    +

    Specifies that when a regular expression match is to be replaced by a new + string, that the new string is constructed using the rules used by the Unix sed + utility in IEEE Std 1003.1-2001, Portable Operating SystemInterface (POSIX ), + Shells and Utilities..

    +
    +

    format_perl

    +
    +

    + Specifies that when a regular expression match is to be replaced by a new + string, that the new string is constructed using the same rules as Perl 5.

    +
    format_allSpecifies that all syntax extensions are + enabled, including conditional (?ddexpression1:expression2) replacements: see + the format string guide for more details.
    +

    format_no_copy

    +
    +

    When specified during a search and replace operation, then sections of the + character container sequence being searched that do match the regular + expression, are not copied to the output string.

    +
    +

    format_first_only

    +
    +

    When specified during a search and replace operation, then only the first + occurrence of the regular expression is replaced.

    +
    +
    +
    +

    +
    +
    +
    +

    Revised + + 17 May 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/match_results.html b/doc/Attic/match_results.html index 9c2d3c64..d3022f84 100644 --- a/doc/Attic/match_results.html +++ b/doc/Attic/match_results.html @@ -1,77 +1,57 @@ - - -Boost.Regex: class match_results - - - - -

    - - - - - - - -
    -

    -"C++

    -
    -

    Boost.Regex

    - -

    class match_results

    -
    -

    -"Boost.Regex

    -
    - -
    -
    - - -
    -

    Contents

    - -
    -
    Synopsis
    - -
    Description
    -
    - -

    Synopsis

    - -

    #include <boost/regex.hpp>

    - -

    Regular expressions are different from many simple -pattern-matching algorithms in that as well as finding an overall -match they can also produce sub-expression matches: each -sub-expression being delimited in the pattern by a pair of -parenthesis (...). There has to be some method for reporting -sub-expression matches back to the user: this is achieved this by -defining a class match_results that acts as an indexed -collection of sub-expression matches, each sub-expression match -being contained in an object of type -sub_match .

    - -

    Template class match_results denotes a collection of character -sequences representing the result of a regular expression match. -Objects of type match_results are passed to the algorithms regex_match and -regex_search, and are returned by the iterator regex_iterator .  Storage for the -collection is allocated and freed as necessary by the member -functions of class match_results.

    - -

    The template class match_results conforms to the requirements of -a Sequence, as specified in (lib.sequence.reqmts), except that only -operations defined for const-qualified Sequences are supported.

    - -

    Class template match_results is most commonly used as one of the -typedefs cmatch, wcmatch, smatch, or wsmatch:

    - -
    +   
    +      Boost.Regex: class match_results
    +      
    +      
    +      
    +   
    +   
    +      

    + + + + + + +
    +

    C++ Boost

    +
    +

    Boost.Regex

    +

    class match_results

    +
    +

    Boost.Regex Index

    +
    +
    +
    +
    +

    Contents

    +
    +
    Synopsis
    Description
    +
    +

    Synopsis

    +

    #include <boost/regex.hpp>

    +

    Regular expressions are different from many simple pattern-matching algorithms + in that as well as finding an overall match they can also produce + sub-expression matches: each sub-expression being delimited in the pattern by a + pair of parenthesis (...). There has to be some method for reporting + sub-expression matches back to the user: this is achieved this by defining a + class match_results that acts as an indexed collection of sub-expression + matches, each sub-expression match being contained in an object of type + sub_match .

    +

    Template class match_results denotes a collection of character sequences + representing the result of a regular expression match. Objects of type + match_results are passed to the algorithms regex_match + and regex_search, and are returned by the + iterator regex_iterator .  Storage for + the collection is allocated and freed as necessary by the member functions of + class match_results.

    +

    The template class match_results conforms to the requirements of a Sequence, as + specified in (lib.sequence.reqmts), except that only operations defined for + const-qualified Sequences are supported.

    +

    Class template match_results is most commonly used as one of the typedefs + cmatch, wcmatch, smatch, or wsmatch:

    +
     template <class BidirectionalIterator,
               class Allocator = allocator<sub_match<BidirectionalIterator> >
     class match_results;
    @@ -98,414 +78,354 @@ public:
        typedef          basic_string<char_type>                                 string_type;
     
        // construct/copy/destroy:
    -   explicit match_results(const Allocator& a = Allocator());
    -   match_results(const match_results& m);
    -   match_results& operator=(const match_results& m); 
    +   explicit match_results(const Allocator& a = Allocator());
    +   match_results(const match_results& m);
    +   match_results& operator=(const match_results& m); 
        ~match_results();
     
        // size:
    -   size_type size() const;
    -   size_type max_size() const;
    -   bool empty() const;
    +   size_type size() const;
    +   size_type max_size() const;
    +   bool empty() const;
        // element access:
    -   difference_type length(int sub = 0) const;
    -   difference_type position(unsigned int sub = 0) const;
    -   string_type str(int sub = 0) const;
    -   const_reference operator[](int n) const;
    +   difference_type length(int sub = 0) const;
    +   difference_type position(unsigned int sub = 0) const;
    +   string_type str(int sub = 0) const;
    +   const_reference operator[](int n) const;
     
    -   const_reference prefix() const;
    +   const_reference prefix() const;
     
    -   const_reference suffix() const;
    -   const_iterator begin() const;
    -   const_iterator end() const;
    +   const_reference suffix() const;
    +   const_iterator begin() const;
    +   const_iterator end() const;
        // format:
        template <class OutputIterator>
    -   OutputIterator format(OutputIterator out,
    +   OutputIterator format(OutputIterator out,
                              const string_type& fmt,
                              match_flag_type flags = format_default) const;
    -   string_type format(const string_type& fmt,
    +   string_type format(const string_type& fmt,
                           match_flag_type flags = format_default) const;
     
    -   allocator_type get_allocator() const;
    -   void swap(match_results& that);
    +   allocator_type get_allocator() const;
    +   void swap(match_results& that);
     };
     
     template <class BidirectionalIterator, class Allocator>
    -bool operator == (const match_results<BidirectionalIterator, Allocator>& m1,
    +bool operator == (const match_results<BidirectionalIterator, Allocator>& m1,
                       const match_results<BidirectionalIterator, Allocator>& m2);
     template <class BidirectionalIterator, class Allocator>
    -bool operator != (const match_results<BidirectionalIterator, Allocator>& m1,
    +bool operator != (const match_results<BidirectionalIterator, Allocator>& m1,
                       const match_results<BidirectionalIterator, Allocator>& m2);
     
     template <class charT, class traits, class BidirectionalIterator, class Allocator>
     basic_ostream<charT, traits>&
    -   operator << (basic_ostream<charT, traits>& os,
    +   operator << (basic_ostream<charT, traits>& os,
                     const match_results<BidirectionalIterator, Allocator>& m);
     
     template <class BidirectionalIterator, class Allocator>
    -void swap(match_results<BidirectionalIterator, Allocator>& m1,
    +void swap(match_results<BidirectionalIterator, Allocator>& m1,
               match_results<BidirectionalIterator, Allocator>& m2);
     
    - -

    Description

    - -

    match_results constructors

    - -

    In all match_results 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.

    - -
    +      

    Description

    +

    match_results constructors

    +

    In all match_results 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.

    +
    
     match_results(const Allocator& a = Allocator());
     
    - - -

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

    - -

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

    Element

    -
    -

    Value

    -
    -

    empty()

    -
    -

    true

    -
    -

    size()

    -
    -

    0

    -
    -

    str()

    -
    -

    basic_string<charT>()

    -
    -
    - -

     

    - -
    +      
    +      

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

    +

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

    Element

    +
    +

    Value

    +
    +

    empty()

    +
    +

    true

    +
    +

    size()

    +
    +

    0

    +
    +

    str()

    +
    +

    basic_string<charT>()

    +
    +
    +

     

    +
    
     match_results(const match_results& m);
     
    - - -

    Effects: Constructs an object of class match_results, as -a copy of m.

    - -
    +      
    +      

    Effects: Constructs an object of class match_results, as a copy of m.

    +
    
     match_results& operator=(const match_results& m);
     
    - - -

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

    - -

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

    Element

    -
    -

    Value

    -
    -

    empty()

    -
    -

    m.empty().

    -
    -

    size()

    -
    -

    m.size().

    -
    -

    str(n)

    -
    -

    m.str(n) for all integers n < m.size().

    -
    -

    prefix()

    -
    -

    m.prefix().

    -
    -

    suffix()

    -
    -

    m.suffix().

    -
    -

    (*this)[n]

    -
    -

    m[n] for all integers n < m.size().

    -
    -

    length(n)

    -
    -

    m.length(n) for all integers n < m.size().

    -
    -

    position(n)

    -
    -

    m.position(n) for all integers n < m.size().

    -
    -
    - -

    match_results size

    - -
    +      
    +      

    Effects: Assigns m to *this. The postconditions of this function are + indicated in the table:

    +

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

    Element

    +
    +

    Value

    +
    +

    empty()

    +
    +

    m.empty().

    +
    +

    size()

    +
    +

    m.size().

    +
    +

    str(n)

    +
    +

    m.str(n) for all integers n < m.size().

    +
    +

    prefix()

    +
    +

    m.prefix().

    +
    +

    suffix()

    +
    +

    m.suffix().

    +
    +

    (*this)[n]

    +
    +

    m[n] for all integers n < m.size().

    +
    +

    length(n)

    +
    +

    m.length(n) for all integers n < m.size().

    +
    +

    position(n)

    +
    +

    m.position(n) for all integers n < m.size().

    +
    +
    +

    match_results size

    +
    
     size_type size()const;
     
    - - -

    Effects: Returns the number of sub_match elements stored -in *this.

    - -
    +      
    +      

    Effects: Returns the number of sub_match elements stored in *this; that + is the number of marked sub-expressions in the regular expression that was + matched plus one.

    +
    
     size_type max_size()const;
     
    - - -

    Effects: Returns the maximum number of sub_match elements -that can be stored in *this.

    - -
    +      
    +      

    Effects: Returns the maximum number of sub_match elements that can be + stored in *this.

    +
    
     bool empty()const;
     
    - - -

    Effects: Returns size() == 0.

    - -

    match_results element access

    - -
    +      
    +      

    Effects: Returns size() == 0.

    +

    match_results element access

    +
    
     difference_type length(int sub = 0)const;
     
    - - -

    Effects: Returns (*this)[sub].length().

    - -
    +      
    +      

    Effects: Returns the length of sub-expression sub, that is to + say: (*this)[sub].length().

    +
    
     difference_type position(unsigned int sub = 0)const;
     
    - - -

    Effects: Returns std::distance(prefix().first, -(*this)[sub].first).

    - -
    +      
    +      

    Effects: Returns the starting location of sub-expression sub, + or -1 if sub was not matched .

    +
    
     string_type str(int sub = 0)const;
     
    - - -

    Effects: Returns -string_type((*this)[sub]).

    - -
    +      
    +      

    Effects: Returns sub-expression sub as a string:  string_type((*this)[sub]).

    +
    
     const_reference operator[](int n) const;
     
    - - -

    Effects: Returns a reference to the -sub_match object representing the character sequence that -matched marked sub-expression n. If n == 0 then -returns a reference to a sub_match object representing -the character sequence that matched the whole regular -expression.

    - -
    +      
    +      

    Effects: Returns a reference to the sub_match object + representing the character sequence that matched marked sub-expression n. + If n == 0 then returns a reference to a sub_match object + representing the character sequence that matched the whole regular + expression.  If n is out of range, or if n is an + unmatched sub-expression, then returns a sub_match object whose matched + member is false.

    +
    
     const_reference prefix()const;
     
    - - -

    Effects: Returns a reference to the -sub_match object representing the character sequence from -the start of the string being matched/searched, to the start of the -match found.

    - -
    +      
    +      

    Effects: Returns a reference to the sub_match object + representing the character sequence from the start of the string being + matched/searched, to the start of the match found.

    +
    
     const_reference suffix()const;
     
    - - -

    Effects: Returns a reference to the -sub_match object representing the character sequence from -the end of the match found to the end of the string being -matched/searched.

    - -
    +      
    +      

    Effects: Returns a reference to the sub_match object + representing the character sequence from the end of the match found to the end + of the string being matched/searched.

    +
    
     const_iterator begin()const;
     
    - - -

    Effects: Returns a starting iterator that enumerates over -all the marked sub-expression matches stored in *this.

    - -
    +      
    +      

    Effects: Returns a starting iterator that enumerates over all the marked + sub-expression matches stored in *this.

    +
    
     const_iterator end()const;
     
    - - -

    Effects: Returns a terminating iterator that enumerates -over all the marked sub-expression matches stored in *this.

    - -

    match_results reformatting

    - -
    +      
    +      

    Effects: Returns a terminating iterator that enumerates over all the + marked sub-expression matches stored in *this.

    +

    match_results reformatting

    +
    
     template <class OutputIterator>
     OutputIterator format(OutputIterator out,
                           const string_type& fmt,
                           match_flag_type flags = format_default);
     
    - - -

    Requires: The type OutputIterator conforms to the Output -Iterator requirements (24.1.2).

    - - -

    Effects: Copies the character sequence [fmt.begin(), -fmt.end()) to OutputIterator out. For each format -specifier or escape sequence in fmt, replace that sequence -with either the character(s) it represents, or the sequence of -characters within *this to which it refers. The bitmasks specified -in flags determines what -format specifiers or escape sequences -are recognized, by default this is the format used by ECMA-262, -ECMAScript Language Specification, Chapter 15 part 5.4.11 -String.prototype.replace.

    - - -

    Returns: out.

    - -
    +      
    +      

    Requires: The type OutputIterator conforms to the Output Iterator + requirements (24.1.2).

    + +

    Effects: Copies the character sequence [fmt.begin(), fmt.end()) to + OutputIterator out. For each format specifier or escape sequence in fmt, + replace that sequence with either the character(s) it represents, or the + sequence of characters within *this to which it refers. The bitmasks specified + in flags determines what + format specifiers or escape sequences are recognized, by default this is + the format used by ECMA-262, ECMAScript Language Specification, Chapter 15 part + 5.4.11 String.prototype.replace.

    + +

    Returns: out.

    +
    
     string_type format(const string_type& fmt,
                        match_flag_type flags = format_default);
     
    - - -

    Effects: Returns a copy of the string fmt. For -each format specifier or escape sequence in fmt, replace -that sequence with either the character(s) it represents, or the -sequence of characters within *this to which it refers. The -bitmasks specified in -flags determines what format -specifiers or escape sequences are recognized, by default this -is the format used by ECMA-262, ECMAScript Language Specification, -Chapter 15 part 5.4.11 String.prototype.replace.

    - -
    +      
    +      

    Effects: Returns a copy of the string fmt. For each format + specifier or escape sequence in fmt, replace that sequence with either + the character(s) it represents, or the sequence of characters within *this to + which it refers. The bitmasks specified in flags + determines what format specifiers or escape sequences + are recognized, by default this is the format used by ECMA-262, + ECMAScript Language Specification, Chapter 15 part 5.4.11 + String.prototype.replace.

    +
    
     allocator_type get_allocator()const;
     
    - - -

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

    - -
    +      
    +      

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

    +
    
     void swap(match_results& that);
     
    - - -

    Effects: Swaps the contents of the two sequences.

    - - -

    Postcondition: *this contains the sequence -of matched sub-expressions that were in that, -that contains the sequence of matched sub-expressions that -were in *this.

    - - -

    Complexity: constant time.

    - -

    - -
    -

    Revised - -17 May 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.

    - + +

    Effects: Swaps the contents of the two sequences.

    + +

    Postcondition: *this contains the sequence of matched + sub-expressions that were in that, that contains the + sequence of matched sub-expressions that were in *this.

    + +

    Complexity: constant time.

    +

    match_results non-members

    +
    template <class BidirectionalIterator, class Allocator>
    +bool operator == (const match_results<BidirectionalIterator, Allocator>& m1,
    +                  const match_results<BidirectionalIterator, Allocator>& m2);
    +

    Effects: Compares the two sequences for equality.

    +
    template <class BidirectionalIterator, class Allocator>
    +bool operator != (const match_results<BidirectionalIterator, Allocator>& m1,
    +                  const match_results<BidirectionalIterator, Allocator>& m2);
    +

    Effects: Compares the two sequences for inequality.

    +
    template <class charT, class traits, class BidirectionalIterator, class Allocator>
    +basic_ostream<charT, traits>&
    +   operator << (basic_ostream<charT, traits>& os,
    +                const match_results<BidirectionalIterator, Allocator>& m);
    +

    Effects: Writes the contents of m to the stream os as + if by calling os << m.str(); Returns os..

    +
    template <class BidirectionalIterator, class Allocator>
    +void swap(match_results<BidirectionalIterator, Allocator>& m1,
    +          match_results<BidirectionalIterator, Allocator>& m2);
    +

    Effects: Swaps the contents of the two sequences.

    +

    +
    +

    Revised + + 17 May 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/redistributables.html b/doc/Attic/redistributables.html index f40f40f4..6a0c7134 100644 --- a/doc/Attic/redistributables.html +++ b/doc/Attic/redistributables.html @@ -25,14 +25,15 @@

    If you are using Microsoft or Borland C++ and link to a dll version of the run - time library, then you will also link to one of the dll versions of - boost.regex. While these dll's are redistributable, there are no "standard" - versions, so when installing on the users PC, you should place these in a - directory private to your application, and not in the PC's directory path. Note - that if you link to a static version of your run time library, then you will - also link to a static version of boost.regex and no dll's will need to be - distributed. The possible boost.regex dll and library names are computed - according to the following formula:
    + time library, then you can choose to also link to a dll version of boost.regex + by defining the symbol BOOST_REGEX_DYN_LINK when you compile your code. While + these dll's are redistributable, there are no "standard" versions, so when + installing on the users PC, you should place these in a directory private to + your application, and not in the PC's directory path. Note that if you link to + a static version of your run time library, then you will also link to a static + version of boost.regex and no dll's will need to be distributed. The possible + boost.regex dll and library names are computed according to the following + formula:

    BOOST_LIB_PREFIX
    diff --git a/doc/Attic/regex_iterator.html b/doc/Attic/regex_iterator.html index 4a24769b..bacc0e0e 100644 --- a/doc/Attic/regex_iterator.html +++ b/doc/Attic/regex_iterator.html @@ -42,40 +42,39 @@ template <class BidirectionalIterator, class regex_iterator { public: - typedef basic_regex<charT, traits, Allocator> regex_type; - typedef match_results<BidirectionalIterator> value_type; + typedef basic_regex<charT, traits, Allocator> regex_type; + typedef match_results<BidirectionalIterator> value_type; typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type; typedef const value_type* pointer; typedef const value_type& reference; typedef std::forward_iterator_tag iterator_category; - regex_iterator(); - regex_iterator(BidirectionalIterator a, BidirectionalIterator b, + regex_iterator(); + regex_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, - match_flag_type m = match_default); - regex_iterator(const regex_iterator&); - regex_iterator& operator=(const regex_iterator&); - bool operator==(const regex_iterator&); - bool operator!=(const regex_iterator&); - const value_type& operator*(); - const value_type* operator->(); - regex_iterator& operator++(); - regex_iterator operator++(int); + match_flag_type m = match_default); + regex_iterator(const regex_iterator&); + regex_iterator& operator=(const regex_iterator&); + bool operator==(const regex_iterator&)const; + bool operator!=(const regex_iterator&)const; + const value_type& operator*()const; + const value_type* operator->()const; + regex_iterator& operator++(); + regex_iterator operator++(int); };

    Description

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

    -
    +      
    
     regex_iterator();
     

    Effects: constructs an end of sequence regex_iterator.

    -
    -regex_iterator(BidirectionalIterator a, BidirectionalIterator b, 
    +      
    regex_iterator(BidirectionalIterator a, BidirectionalIterator b, 
                    const regex_type& re, 
    -               match_flag_type m = match_default);
    +               match_flag_type m = match_default);
     

    Effects: constructs a regex_iterator that will enumerate all occurrences @@ -88,32 +87,32 @@ regex_iterator(BidirectionalIterator a, BidirectionalIterator b, Boost.regex is configured in recursive mode), or if the matcher exhausts it's permitted memory allocation (if Boost.regex is configured in non-recursive mode).

    -
    +      
    
     regex_iterator(const regex_iterator& that);
     

    Effects: constructs a copy of that.

    Postconditions: *this == that.

    -
    +      
    
     regex_iterator& operator=(const regex_iterator&);
     

    Effects: sets *this equal to those in that.

    Postconditions: *this == that.

    -
    -bool operator==(const regex_iterator& that);
    +      
    
    +bool operator==(const regex_iterator& that)const;
     

    Effects: returns true if *this is equal to that.

    -
    -bool operator!=(const regex_iterator&);
    +      
    
    +bool operator!=(const regex_iterator&)const;
     

    Effects: returns !(*this == that).

    -
    -const value_type& operator*();
    +      
    
    +const value_type& operator*()const;
     

    Effects: dereferencing a regex_iterator object it yields a const reference to a match_results object, @@ -159,7 +158,8 @@ const value_type& operator*();

    (*it).prefix().last

    -

    (*it)[0].first

    +

    The same as the start of the match found:
    + (*it)[0].first

    @@ -167,7 +167,8 @@ const value_type& operator*();

    (*it).prefix().matched

    -

    (*it).prefix().first != (*it).prefix().second

    +

    True if the prefix did not match an empty string:
    + (*it).prefix().first != (*it).prefix().second

    @@ -175,7 +176,8 @@ const value_type& operator*();

    (*it).suffix().first

    -

    (*it)[0].second

    +

    The same as the end of the match found:
    + (*it)[0].second

    @@ -191,7 +193,8 @@ const value_type& operator*();

    (*it).suffix().matched

    -

    (*it).suffix().first != (*it).suffix().second

    +

    True if the suffix did not match an empty string:
    + (*it).suffix().first != (*it).suffix().second

    @@ -259,12 +262,12 @@ const value_type& operator*();

    -
    -const value_type* operator->();
    +      
    
    +const value_type* operator->()const;
     

    Effects: returns &(*this).

    -
    +      
    
     regex_iterator& operator++();
     

    Effects: moves the iterator to the next match in the @@ -282,7 +285,7 @@ regex_iterator& operator++(); configured in non-recursive mode).

    Returns: *this.

    -
    +      
    
     regex_iterator operator++(int);
     
    diff --git a/doc/Attic/regex_match.html b/doc/Attic/regex_match.html index 309d33d4..53a0dfad 100644 --- a/doc/Attic/regex_match.html +++ b/doc/Attic/regex_match.html @@ -31,47 +31,53 @@

    Synopsis

    #include <boost/regex.hpp> 
    -

    The algorithm regex _match determines whether a given regular expression - matches a given sequence denoted by a pair of bidirectional-iterators, the - algorithm is defined as follows, note that the result is true only if the - expression matches the whole of the input sequence, the main use of - this function is data input validation. +

    + The algorithm regex _match determines whether a given regular expression + matches all of a given character sequence denoted by a pair of + bidirectional-iterators, the algorithm is defined as follows, the main use of + this function is data input validation. +

    Note that the result is true only if the expression matches the whole of + the input sequence.  If you want to search for an expression + somewhere within the sequence then use regex_search.  + If you want to match a prefix of the character string then use + regex_search with the flag match_continuous + set.

    template <class BidirectionalIterator, class Allocator, class charT,
               class traits, class Allocator2>
    -bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
    +bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
                      match_results<BidirectionalIterator, Allocator>& m,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);
                      
     template <class BidirectionalIterator, class charT, class traits, class Allocator2>
    -bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
    +bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);
                      
     template <class charT, class Allocator, class traits, class Allocator2>
    -bool regex_match(const charT* str, match_results<const charT*, Allocator>& m,
    +bool regex_match(const charT* str, match_results<const charT*, Allocator>& m,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);
                      
     template <class ST, class SA, class Allocator, class charT,
               class traits, class Allocator2>
    -bool regex_match(const basic_string<charT, ST, SA>& s,
    +bool regex_match(const basic_string<charT, ST, SA>& s,
                      match_results<typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m, 
                      const basic_regex<charT, traits, Allocator2>& e, 
                      match_flag_type flags = match_default);
                      
     template <class charT, class traits, class Allocator2>
    -bool regex_match(const charT* str,
    +bool regex_match(const charT* str,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);
                      
     template <class ST, class SA, class charT, class traits, class Allocator2>
    -bool regex_match(const basic_string<charT, ST, SA>& s,
    +bool regex_match(const basic_string<charT, ST, SA>& s,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);
     

    Description

    -
    template <class BidirectionalIterator, class Allocator, class charT,
    +         
    template <class BidirectionalIterator, class Allocator, class charT,
               class traits, class Allocator2>
     bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
                      match_results<BidirectionalIterator, Allocator>& m,
    @@ -84,9 +90,9 @@ bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
                 flags is used to control how the expression 
                 is matched against the character sequence. Returns true if such a match 
              exists, false otherwise.

    -

    Throws: std::runtime_error if the complexity of matching the - expression against an N character string begins to exceed O(N2), or - if the program runs out of stack space while matching the expression (if +

    Throws: std::runtime_error if the complexity of + matching the expression against an N character string begins to exceed O(N2), + or if the program runs out of stack space while matching the expression (if Boost.regex is configured in recursive mode), or if the matcher exhausts it's permitted memory allocation (if Boost.regex is configured in non-recursive mode).

    @@ -231,20 +237,20 @@ bool regex_match(BidirectionalIterator first, BidirectionalIterator last,

     
    -
    template <class BidirectionalIterator, class charT, class traits, class Allocator2>
    +      
    template <class BidirectionalIterator, class charT, class traits, class Allocator2>
     bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);

    Effects: Behaves "as if" by constructing an instance of match_results<BidirectionalIterator> what, and then returning the result of regex_match(first, last, what, e, flags).

    -
    template <class charT, class Allocator, class traits, class Allocator2>
    +      
    template <class charT, class Allocator, class traits, class Allocator2>
     bool regex_match(const charT* str, match_results<const charT*, Allocator>& m,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);

    Effects: Returns the result of regex_match(str, str + char_traits<charT>::length(str), m, e, flags).

    -
    template <class ST, class SA, class Allocator, class charT,
    +      
    template <class ST, class SA, class Allocator, class charT,
               class traits, class Allocator2>
     bool regex_match(const basic_string<charT, ST, SA>& s,
                      match_results<typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m, 
    @@ -252,13 +258,13 @@ bool regex_match(const basic_string<charT, ST, SA>& s,
                      match_flag_type flags = match_default);

    Effects: Returns the result of regex_match(s.begin(), s.end(), m, e, flags).

    -
    template <class charT, class traits, class Allocator2>
    +      
    template <class charT, class traits, class Allocator2>
     bool regex_match(const charT* str,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);

    Effects: Returns the result of regex_match(str, str + char_traits<charT>::length(str), e, flags).

    -
    template <class ST, class SA, class charT, class traits, class Allocator2>
    +      
    template <class ST, class SA, class charT, class traits, class Allocator2>
     bool regex_match(const basic_string<charT, ST, SA>& s,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);
    diff --git a/doc/Attic/regex_replace.html b/doc/Attic/regex_replace.html index 8ff9764d..0fe074a8 100644 --- a/doc/Attic/regex_replace.html +++ b/doc/Attic/regex_replace.html @@ -29,7 +29,7 @@

    Synopsis

    #include <boost/regex.hpp> 

    The algorithm regex_replace searches through a string finding - all the matches to the regular expression: for each match it then calls + all the matches to the regular expression: for each match it then calls match_results::format to format the string and sends the result to the output iterator. Sections of text that do not match are copied to the output unchanged only if the flags parameter does not have the flag @@ -37,39 +37,87 @@ is set then only the first occurrence is replaced rather than all occurrences. 

    template <class OutputIterator, class BidirectionalIterator, class traits,
               class Allocator, class charT>
    -OutputIterator regex_replace(OutputIterator out,
    +OutputIterator regex_replace(OutputIterator out,
                                BidirectionalIterator first,
                                BidirectionalIterator last,
    -                           const basic_regex<charT, traits, Allocator>& e,
    +                           const basic_regex<charT, traits, Allocator>& e,
                                const basic_string<charT>& fmt,
    -                           match_flag_type flags = match_default);
    +                           match_flag_type flags = match_default);
     
     template <class traits, class Allocator, class charT>
    -basic_string<charT> regex_replace(const basic_string<charT>& s,
    -                            const basic_regex<charT, traits, Allocator>& e,
    +basic_string<charT> regex_replace(const basic_string<charT>& s,
    +                            const basic_regex<charT, traits, Allocator>& e,
                                 const basic_string<charT>& fmt,
    -                            match_flag_type flags = match_default);
    +                            match_flag_type flags = match_default);
     
     

    Description

    -
    template <class OutputIterator, class BidirectionalIterator, class traits,
    +         
    template <class OutputIterator, class BidirectionalIterator, class traits,
               class Allocator, class charT>
     OutputIterator regex_replace(OutputIterator out,
                                BidirectionalIterator first,
                                BidirectionalIterator last,
    -                           const basic_regex<charT, traits, Allocator>& e,
    +                           const basic_regex<charT, traits, Allocator>& e,
                                const basic_string<charT>& fmt,
    -                           match_flag_type flags = match_default);
    -

    Effects: Finds all the non-overlapping matches m of type match_results<BidirectionalIterator> - that occur within the sequence [first, last). If no such matches are - found and !(flags & format_no_copy) then calls std::copy(first, - last, out). Otherwise, for each match found, if !(flags & - format_no_copy) calls std::copy(m.prefix().first, m.prefix().last, - out), and then calls m.format(out, fmt, flags). Finally - if !(flags & format_no_copy) calls std::copy(last_m.suffix().first, - last_m,suffix().last, out) where last_m is a copy of the - last match found. If flags & format_first_only is non-zero - then only the first match found is replaced.

    + match_flag_type flags = match_default);
    +

    Enumerates all the occurences of expression e in the sequence [first, + last), replacing each occurence with the string that results by merging the + match found with the format string fmt, and copies the resulting + string to out

    +

    If the flag format_no_copy is set in flags then unmatched sections of + text are not copied to output.  +

    +

    If the flag format_first_only is set in flags then only the first + occurence of e is replaced.  +

    +

    The manner in which the format string fmt is interpretted, along with + the rules used for finding matches, are determined by the + flags set in flags

    +

    Effects: Constructs an + regex_iterator + object: +

    +
    regex_iterator<BidirectionalIterator, charT, traits, Allocator> 
    i(first, last, e, flags),
    +

    and uses + + i + to enumerate through all of the matches m of type + + match_results + <BidirectionalIterator> that + occur within the sequence [first, last). +

    +

    If no such matches are found + and

    +
    !(flags & format_no_copy) 
    +

    then calls +

    +
    std::copy(first, last, out). 
    +

    Otherwise, for each match found, + if

    +
    !(flags & format_no_copy) 
    +

    calls +

    +
    std::copy(m.prefix().first, m.prefix().last, out), 
    +

    and then calls +

    +
    m.format(out, fmt, flags). 
    +

    Finally + if

    +
    !(flags & format_no_copy) 
    +

    calls +

    +
    std::copy(last_m.suffix().first, last_m,suffix().last, out) 
    +

    where + + last_m + + is a copy of the last match found. +

    +

    If + flags & +format_first_only + is non-zero then only the first match found is replaced.

    Throws: std::runtime_error if the complexity of matching the expression against an N character string begins to exceed O(N2), or if the program runs out of stack space while matching the expression (if @@ -78,11 +126,11 @@ OutputIterator regex_replace(OutputIterator out, configured in non-recursive mode).

    Returns: out.

    -
    template <class traits, class Allocator, class charT>
    +      
    template <class traits, class Allocator, class charT>
     basic_string<charT> regex_replace(const basic_string<charT>& s,
    -                            const basic_regex<charT, traits, Allocator>& e,
    +                            const basic_regex<charT, traits, Allocator>& e,
                                 const basic_string<charT>& fmt,
    -                            match_flag_type flags = match_default);
    + match_flag_type flags = match_default);

    Effects: Constructs an object basic_string<charT> result, calls regex_replace(back_inserter(result), s.begin(), s.end(), e, fmt, flags), and then returns result. diff --git a/doc/Attic/regex_search.html b/doc/Attic/regex_search.html index 97850ba7..f7017fea 100644 --- a/doc/Attic/regex_search.html +++ b/doc/Attic/regex_search.html @@ -37,7 +37,7 @@

    template <class BidirectionalIterator, 
               class Allocator, class charT,
               class traits, class Allocator2>
    -bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
    +bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
                       match_results<BidirectionalIterator, Allocator>& m,
                       const basic_regex<charT, traits, Allocator2>& e,
                       match_flag_type flags = match_default);
    @@ -45,7 +45,7 @@ bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
     template <class ST, class SA, 
               class Allocator, class charT,
               class traits, class Allocator2> 
    -bool regex_search(const basic_string<charT, ST, SA>& s, 
    +bool regex_search(const basic_string<charT, ST, SA>& s, 
                       match_results<
                           typename basic_string<charT, ST,SA>::const_iterator, 
                           Allocator>& m, 
    @@ -54,32 +54,32 @@ bool regex_search(const basic_string<charT, ST, SA>& s,
               
     template<class charT, class Allocator, class traits, 
              class Allocator2> 
    -bool regex_search(const charT* str, 
    +bool regex_search(const charT* str, 
                       match_results<const charT*, Allocator>& m, 
                       const basic_regex<charT, traits, Allocator2>& e,
                       match_flag_type flags = match_default);
                       
     template <class BidirectionalIterator, class Allocator,
               class charT, class traits>                
    -bool regex_search(BidirectionalIterator first, BidirectionalIterator last, 
    +bool regex_search(BidirectionalIterator first, BidirectionalIterator last, 
                       const basic_regex<charT, traits, Allocator>& e, 
                       match_flag_type flags = match_default); 
                       
     template <class charT, class Allocator, 
               class traits> 
    -bool regex_search(const charT* str, 
    +bool regex_search(const charT* str, 
                       const basic_regex<charT, traits, Allocator>& e, 
                       match_flag_type flags = match_default); 
                       
     template<class ST, class SA,
              class Allocator, class charT, 
              class traits>
    -bool regex_search(const basic_string<charT, ST, SA>& s,
    +bool regex_search(const basic_string<charT, ST, SA>& s,
                       const basic_regex<charT, traits, Allocator>& e,
                       match_flag_type flags = match_default);
     

    Description

    -
    template <class BidirectionalIterator, class Allocator, class charT,
    +         
    template <class BidirectionalIterator, class Allocator, class charT,
               class traits, class Allocator2>
     bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
                       match_results<BidirectionalIterator, Allocator>& m,
    @@ -234,13 +234,13 @@ bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
                    
              
           
    -      
    template <class charT, class Allocator, class traits, class Allocator2>
    +      
    template <class charT, class Allocator, class traits, class Allocator2>
     bool regex_search(const charT* str, match_results<const charT*, Allocator>& m,
                       const basic_regex<charT, traits, Allocator2>& e,
                       match_flag_type flags = match_default);

    Effects: Returns the result of regex_search(str, str + char_traits<charT>::length(str), m, e, flags).

    -
    template <class ST, class SA, class Allocator, class charT,
    +      
    template <class ST, class SA, class Allocator, class charT,
               class traits, class Allocator2>
     bool regex_search(const basic_string<charT, ST, SA>& s,
                       match_results<typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
    @@ -248,7 +248,7 @@ bool regex_search(const basic_string<charT, ST, SA>& s,
                       match_flag_type flags = match_default);

    Effects: Returns the result of regex_search(s.begin(), s.end(), m, e, flags).

    -
    template <class iterator, class Allocator, class charT,
    +      
    template <class iterator, class Allocator, class charT,
               class traits>
     bool regex_search(iterator first, iterator last,
                       const basic_regex<charT, traits, Allocator>& e,
    @@ -256,13 +256,13 @@ bool regex_search(iterator first, iterator last,
           

    Effects: Behaves "as if" by constructing an instance of match_results<BidirectionalIterator> what, and then returning the result of regex_search(first, last, what, e, flags).

    -
    template <class charT, class Allocator, class traits>
    +      
    template <class charT, class Allocator, class traits>
     bool regex_search(const charT* str
                       const basic_regex<charT, traits, Allocator>& e,
                       match_flag_type flags = match_default);

    Effects: Returns the result of regex_search(str, str + char_traits<charT>::length(str), e, flags).

    -
    template <class ST, class SA, class Allocator, class charT,
    +      
    template <class ST, class SA, class Allocator, class charT,
               class traits>
     bool regex_search(const basic_string<charT, ST, SA>& s,
                       const basic_regex<charT, traits, Allocator>& e,
    diff --git a/doc/Attic/regex_token_iterator.html b/doc/Attic/regex_token_iterator.html
    index 03e2e64e..838dcf28 100644
    --- a/doc/Attic/regex_token_iterator.html
    +++ b/doc/Attic/regex_token_iterator.html
    @@ -45,35 +45,35 @@ template <class BidirectionalIterator,
     class regex_token_iterator 
     {
     public:
    -   typedef          basic_regex<charT, traits, Allocator>                   regex_type;
    +   typedef          basic_regex<charT, traits, Allocator>                   regex_type;
        typedef          basic_string<charT>                                     value_type;
        typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type;
        typedef          const value_type*                                       pointer;
        typedef          const value_type&                                       reference;
        typedef          std::forward_iterator_tag                               iterator_category;
        
    -   regex_token_iterator();
    -   regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
    -                        int submatch = 0, match_flag_type m = match_default);
    -   regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
    +   regex_token_iterator();
    +   regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
    +                        int submatch = 0, match_flag_type m = match_default);
    +   regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
                             const std::vector<int>& submatches, match_flag_type m = match_default);
        template <std::size_t N>
    -   regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
    +   regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
                             const int (&submatches)[N], match_flag_type m = match_default);
    -   regex_token_iterator(const regex_token_iterator&);
    -   regex_token_iterator& operator=(const regex_token_iterator&);
    -   bool operator==(const regex_token_iterator&);
    -   bool operator!=(const regex_token_iterator&);
    -   const value_type& operator*();
    -   const value_type* operator->();
    -   regex_token_iterator& operator++();
    -   regex_token_iterator operator++(int);
    +   regex_token_iterator(const regex_token_iterator&);
    +   regex_token_iterator& operator=(const regex_token_iterator&);
    +   bool operator==(const regex_token_iterator&)const;
    +   bool operator!=(const regex_token_iterator&)const;
    +   const value_type& operator*()const;
    +   const value_type* operator->()const;
    +   regex_token_iterator& operator++();
    +   regex_token_iterator operator++(int);
     };
     

    Description

    -
    regex_token_iterator();
    +
    regex_token_iterator();

    Effects: constructs an end of sequence iterator.

    -
    regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
    +      
    regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
                          int submatch = 0, match_flag_type m = match_default);

    Preconditions: !re.empty().

    Effects: constructs a regex_token_iterator that will enumerate one @@ -88,7 +88,7 @@ public: Boost.regex is configured in recursive mode), or if the matcher exhausts it's permitted memory allocation (if Boost.regex is configured in non-recursive mode).

    -
    regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
    +      
    regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
                          const std::vector<int>& submatches, match_flag_type m = match_default);

    Preconditions: submatches.size() && !re.empty().

    Effects: constructs a regex_token_iterator that will enumerate submatches.size() @@ -106,7 +106,7 @@ public: Boost.regex is configured in recursive mode), or if the matcher exhausts it's permitted memory allocation (if Boost.regex is configured in non-recursive mode).

    -
    template <std::size_t N>
    +      
    template <std::size_t N>
     regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
                          const int (&submatches)[R], match_flag_type m = match_default);

    Preconditions: !re.empty().

    @@ -126,25 +126,25 @@ regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const reg Boost.regex is configured in recursive mode), or if the matcher exhausts it's permitted memory allocation (if Boost.regex is configured in non-recursive mode).

    -
    regex_token_iterator(const regex_token_iterator& that);
    +
    regex_token_iterator(const regex_token_iterator& that);

    Effects: constructs a copy of that.

    Postconditions: *this == that.

    -
    regex_token_iterator& operator=(const regex_token_iterator& that);
    +
    regex_token_iterator& operator=(const regex_token_iterator& that);

    Effects: sets *this to be equal to that.

    Postconditions: *this == that.

    -
    bool operator==(const regex_token_iterator&);
    +
    bool operator==(const regex_token_iterator&)const;

    Effects: returns true if *this is the same position as that.

    -
    bool operator!=(const regex_token_iterator&);
    +
    bool operator!=(const regex_token_iterator&)const;

    Effects: returns !(*this == that).

    -
    const value_type& operator*();
    +
    const value_type& operator*()const;

    Effects: returns the current string being enumerated.

    -
    const value_type* operator->();
    +
    const value_type* operator->()const;

    Effects: returns &(*this).

    -
    regex_token_iterator& operator++();
    +
    regex_token_iterator& operator++();

    Effects: Moves on to the next string to be enumerated.

    Throws: std::runtime_error if the complexity of @@ -155,7 +155,7 @@ regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const reg configured in non-recursive mode).

    - Returns: *this.

    regex_token_iterator& operator++(int);
    + Returns: *this.

    regex_token_iterator& operator++(int);

    Effects: constructs a copy result of *this, then calls ++(*this).

    Returns: result. diff --git a/doc/Attic/sub_match.html b/doc/Attic/sub_match.html index 19b12c8d..fc966dd9 100644 --- a/doc/Attic/sub_match.html +++ b/doc/Attic/sub_match.html @@ -38,6 +38,9 @@

    Objects of type sub_match may only obtained by subscripting an object of type match_results . +

    Objects of type sub_match may be compared to objects of type std::basic_string, + or const charT* or const charT + .

    When the marked sub-expression denoted by an object of type sub_match<> participated in a regular expression match then member matched evaluates to true, and members first and second denote the @@ -61,154 +64,197 @@ public: typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type; typedef BidirectionalIterator iterator; - bool matched; + bool matched; - difference_type length()const; - operator basic_string<value_type>()const; - basic_string<value_type> str()const; + difference_type length()const; + operator basic_string<value_type>()const; + basic_string<value_type> str()const; - int compare(const sub_match& s)const; - int compare(const basic_string<value_type>& s)const; - int compare(const value_type* s)const; + int compare(const sub_match& s)const; + int compare(const basic_string<value_type>& s)const; + int compare(const value_type* s)const; }; - +// +// comparisons to another sub_match: +// template <class BidirectionalIterator> -bool operator == (const sub_match<BidirectionalIterator>& lhs, +bool operator == (const sub_match<BidirectionalIterator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator != (const sub_match<BidirectionalIterator>& lhs, +bool operator != (const sub_match<BidirectionalIterator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator < (const sub_match<BidirectionalIterator>& lhs, +bool operator < (const sub_match<BidirectionalIterator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator <= (const sub_match<BidirectionalIterator>& lhs, +bool operator <= (const sub_match<BidirectionalIterator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator >= (const sub_match<BidirectionalIterator>& lhs, +bool operator >= (const sub_match<BidirectionalIterator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator > (const sub_match<BidirectionalIterator>& lhs, +bool operator > (const sub_match<BidirectionalIterator>& lhs, const sub_match<BidirectionalIterator>& rhs); +// +// comparisons to a basic_string: +// template <class BidirectionalIterator, class traits, class Allocator> -bool operator == (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, +bool operator == (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator != (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, +bool operator != (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator < (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, +bool operator < (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator > (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, +bool operator > (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator >= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, +bool operator >= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator <= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, +bool operator <= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator == (const sub_match<BidirectionalIterator>& lhs, +bool operator == (const sub_match<BidirectionalIterator>& lhs, const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator != (const sub_match<BidirectionalIterator>& lhs, +bool operator != (const sub_match<BidirectionalIterator>& lhs, const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator < (const sub_match<BidirectionalIterator>& lhs, +bool operator < (const sub_match<BidirectionalIterator>& lhs, const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator > (const sub_match<BidirectionalIterator>& lhs, +bool operator > (const sub_match<BidirectionalIterator>& lhs, const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator >= (const sub_match<BidirectionalIterator>& lhs, +bool operator >= (const sub_match<BidirectionalIterator>& lhs, const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator <= (const sub_match<BidirectionalIterator>& lhs, +bool operator <= (const sub_match<BidirectionalIterator>& lhs, const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs); +// +// comparisons to a pointer to a character array: +// template <class BidirectionalIterator> -bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, +bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, +bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, +bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, +bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, +bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, +bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator == (const sub_match<BidirectionalIterator>& lhs, +bool operator == (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const* rhs); template <class BidirectionalIterator> -bool operator != (const sub_match<BidirectionalIterator>& lhs, +bool operator != (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const* rhs); template <class BidirectionalIterator> -bool operator < (const sub_match<BidirectionalIterator>& lhs, +bool operator < (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const* rhs); template <class BidirectionalIterator> -bool operator > (const sub_match<BidirectionalIterator>& lhs, +bool operator > (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const* rhs); template <class BidirectionalIterator> -bool operator >= (const sub_match<BidirectionalIterator>& lhs, +bool operator >= (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const* rhs); template <class BidirectionalIterator> -bool operator <= (const sub_match<BidirectionalIterator>& lhs, +bool operator <= (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const* rhs); +// +// comparisons to a single character: +// template <class BidirectionalIterator> -bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, +bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, +bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, +bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, +bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, +bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, +bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator == (const sub_match<BidirectionalIterator>& lhs, +bool operator == (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const& rhs); template <class BidirectionalIterator> -bool operator != (const sub_match<BidirectionalIterator>& lhs, +bool operator != (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const& rhs); template <class BidirectionalIterator> -bool operator < (const sub_match<BidirectionalIterator>& lhs, +bool operator < (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const& rhs); template <class BidirectionalIterator> -bool operator > (const sub_match<BidirectionalIterator>& lhs, +bool operator > (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const& rhs); template <class BidirectionalIterator> -bool operator >= (const sub_match<BidirectionalIterator>& lhs, +bool operator >= (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const& rhs); template <class BidirectionalIterator> -bool operator <= (const sub_match<BidirectionalIterator>& lhs, +bool operator <= (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const& rhs); +// +// addition operators: +// +template <class RandomAccessIterator, class traits, class Allocator> +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator> + operator + (const std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s, + const sub_match<RandomAccessIterator>& m); +template <class RandomAccessIterator, class traits, class Allocator> +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator> + operator + (const sub_match<RandomAccessIterator>& m, + const std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s); +template <class RandomAccessIterator> std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> + operator + (typename iterator_traits<RandomAccessIterator>::value_type const* s, + const sub_match<RandomAccessIterator>& m); +template <class RandomAccessIterator> std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> + operator + (const sub_match<RandomAccessIterator>& m, + typename iterator_traits<RandomAccessIterator>::value_type const * s); +template <class RandomAccessIterator> +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> + operator + (typename iterator_traits<RandomAccessIterator>::value_type const& s, + const sub_match<RandomAccessIterator>& m); +template <class RandomAccessIterator> +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> + operator + (const sub_match<RandomAccessIterator>& m, + typename iterator_traits<RandomAccessIterator>::value_type const& s); +template <class RandomAccessIterator> +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> + operator + (const sub_match<RandomAccessIterator>& m1, + const sub_match<RandomAccessIterator>& m2); +// +// stream inserter: +// template <class charT, class traits, class BidirectionalIterator> basic_ostream<charT, traits>& - operator << (basic_ostream<charT, traits>& os, + operator << (basic_ostream<charT, traits>& os, const sub_match<BidirectionalIterator>& m); } // namespace boost

    @@ -225,188 +271,278 @@ basic_ostream<charT, traits>&

    An iterator denoting the position of the start of the match.

    iterator second

    An iterator denoting the position of the end of the match.

    -
    bool matched
    +
    bool matched

    A Boolean value denoting whether this sub-expression participated in the match.

    -
    static difference_type length();
    - -

    - Effects: returns (matched ? 0 : distance(first, second)).

    operator basic_string<value_type>()const;
    - -

    - Effects: returns (matched ? basic_string<value_type>(first, - second) : basic_string<value_type>()).

    basic_string<value_type> str()const;
    - -

    - Effects: returns (matched ? basic_string<value_type>(first, - second) : basic_string<value_type>()).

    int compare(const sub_match& s)const;
    - -

    - Effects: returns str().compare(s.str()).

    int compare(const basic_string<value_type>& s)const;
    - -

    - Effects: returns str().compare(s).

    int compare(const value_type* s)const;
    - -

    - Effects: returns str().compare(s).

    +
    static difference_type length();
    +

    + Effects: returns the length of this matched sub-expression, or 0 if this + sub-expression was not matched: matched ? distance(first, second) : 0).

    +
    operator basic_string<value_type>()const;
    +

    + Effects: converts *this into a string: returns (matched ? + basic_string<value_type>(first, second) : + basic_string<value_type>()).

    +
    basic_string<value_type> str()const;
    +

    Effects: returns a string representation of *this:  (matched ? + basic_string<value_type>(first, second) : + basic_string<value_type>()).

    +
    int compare(const sub_match& s)const;
    +

    + Effects: performs a lexical comparison to s: returns str().compare(s.str()).

    +
    int compare(const basic_string<value_type>& s)const;
    +

    Effects: compares *this to the string s: returns str().compare(s).

    +
    int compare(const value_type* s)const;
    +

    + Effects: compares *this to the null-terminated string s: returns + str().compare(s).

    sub_match non-member operators

    -
    template <class BidirectionalIterator>
    +      
    Comparisons against self
    +
    template <class BidirectionalIterator>
     bool operator == (const sub_match<BidirectionalIterator>& lhs,
                       const sub_match<BidirectionalIterator>& rhs);
    - -

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

    template <class BidirectionalIterator>
    +      

    + Effects: returns lhs.compare(rhs) == 0.

    +
    template <class BidirectionalIterator>
     bool operator != (const sub_match<BidirectionalIterator>& lhs,
                       const sub_match<BidirectionalIterator>& rhs);
    - -

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

    template <class BidirectionalIterator>
    +      

    + Effects: returns lhs.compare(rhs) != 0.

    +
    template <class BidirectionalIterator>
     bool operator < (const sub_match<BidirectionalIterator>& lhs,
                      const sub_match<BidirectionalIterator>& rhs);
    - -

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

    template <class BidirectionalIterator>
    +      

    + Effects: returns lhs.compare(rhs) < 0.

    +
    template <class BidirectionalIterator>
     bool operator <= (const sub_match<BidirectionalIterator>& lhs,
                       const sub_match<BidirectionalIterator>& rhs);
    - -

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

    template <class BidirectionalIterator>
    +      

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

    +
    template <class BidirectionalIterator>
     bool operator >= (const sub_match<BidirectionalIterator>& lhs,
                       const sub_match<BidirectionalIterator>& rhs);
    - -

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

    template <class BidirectionalIterator>
    +      

    + Effects: returns lhs.compare(rhs) >= 0.

    +
    template <class BidirectionalIterator>
     bool operator > (const sub_match<BidirectionalIterator>& lhs,
                      const sub_match<BidirectionalIterator>& rhs);
    - -

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

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.compare(rhs) > 0.

    +
    Comparisons with std::basic_string
    +
    
    +template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator == (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits,
    +                  Allocator>& lhs, const sub_match<BidirectionalIterator>& rhs);
    +
    +

    Effects: returns lhs == rhs.str().

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator != (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
    +                  const sub_match<BidirectionalIterator>& rhs);
    +

    Effects: returns lhs != rhs.str().

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator < (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
    +                 const sub_match<BidirectionalIterator>& rhs);
    +

    Effects: returns lhs < rhs.str().

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator > (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
    +                 const sub_match<BidirectionalIterator>& rhs);
    +

    Effects: returns lhs > rhs.str().

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator >= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
    +                  const sub_match<BidirectionalIterator>& rhs);
    +

    Effects: returns lhs >= rhs.str().

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator <= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
    +                  const sub_match<BidirectionalIterator>& rhs);
    +

    Effects: returns lhs <= rhs.str().

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator == (const sub_match<BidirectionalIterator>& lhs,
    +                  const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
    +

    Effects: returns lhs.str() == rhs.

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator != (const sub_match<BidirectionalIterator>& lhs,
    +                  const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
    +

    Effects: returns lhs.str() != rhs.

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator < (const sub_match<BidirectionalIterator>& lhs,
    +                 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
    +

    Effects: returns lhs.str() < rhs.

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator > (const sub_match<BidirectionalIterator>& lhs,
    +                 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
    +

    Effects: returns lhs.str() > rhs.

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator >= (const sub_match<BidirectionalIterator>& lhs,
    +                  const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
    +

    Effects: returns lhs.str() >= rhs.

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator <= (const sub_match<BidirectionalIterator>& lhs,
    +                  const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
    +

    Effects: returns lhs.str() <= rhs.

    +
    Comparisons with null-terminated strings
    +
    template <class BidirectionalIterator> 
     bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 
                       const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs == rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs == rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 
                       const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs != rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs != rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 
                      const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs < rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs < rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 
                      const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs > rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs > rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 
                       const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs >= rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs >= rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 
                       const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs <= rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs <= rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator == (const sub_match<BidirectionalIterator>& lhs, 
                       typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 
    - -

    - Effects: returns lhs.str() == rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() == rhs.

    +
    template <class BidirectionalIterator> 
     bool operator != (const sub_match<BidirectionalIterator>& lhs, 
                       typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 
    - -

    - Effects: returns lhs.str() != rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() != rhs.

    +
    template <class BidirectionalIterator> 
     bool operator < (const sub_match<BidirectionalIterator>& lhs, 
                      typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 
    - -

    - Effects: returns lhs.str() < rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() < rhs.

    +
    template <class BidirectionalIterator> 
     bool operator > (const sub_match<BidirectionalIterator>& lhs, 
                      typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 
    - -

    - Effects: returns lhs.str() > rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() > rhs.

    +
    template <class BidirectionalIterator> 
     bool operator >= (const sub_match<BidirectionalIterator>& lhs, 
                       typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 
    - -

    - Effects: returns lhs.str() >= rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() >= rhs.

    +
    template <class BidirectionalIterator> 
     bool operator <= (const sub_match<BidirectionalIterator>& lhs, 
                       typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 
    - -

    - Effects: returns lhs.str() <= rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() <= rhs.

    +
    Comparisons with a single character
    +
    template <class BidirectionalIterator> 
     bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 
                       const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs == rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs == rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 
                       const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs != rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs != rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 
                      const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs < rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs < rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 
                      const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs > rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs > rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 
                       const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs >= rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs >= rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 
                       const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs <= rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs <= rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator == (const sub_match<BidirectionalIterator>& lhs, 
                       typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 
    - -

    - Effects: returns lhs.str() == rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() == rhs.

    +
    template <class BidirectionalIterator> 
     bool operator != (const sub_match<BidirectionalIterator>& lhs, 
                       typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 
    - -

    - Effects: returns lhs.str() != rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() != rhs.

    +
    template <class BidirectionalIterator> 
     bool operator < (const sub_match<BidirectionalIterator>& lhs, 
                      typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 
    - -

    - Effects: returns lhs.str() < rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() < rhs.

    +
    template <class BidirectionalIterator> 
     bool operator > (const sub_match<BidirectionalIterator>& lhs, 
                      typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 
    - -

    - Effects: returns lhs.str() > rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() > rhs.

    +
    template <class BidirectionalIterator> 
     bool operator >= (const sub_match<BidirectionalIterator>& lhs, 
                       typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 
    - -

    - Effects: returns lhs.str() >= rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() >= rhs.

    +
    template <class BidirectionalIterator> 
     bool operator <= (const sub_match<BidirectionalIterator>& lhs, 
                       typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 
    - -

    - Effects: returns lhs.str() <= rhs.

    template <class charT, class traits, class BidirectionalIterator>
    +      

    + Effects: returns lhs.str() <= rhs.

    +
    Addition operators
    +

    The addition operators for sub_match allow you to add a sub_match to any type + to which you can add a std::string and obtain a new string as the result.

    +
    template <class RandomAccessIterator, class traits, class Allocator> 
    +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator> 
    +    operator + (const std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s, 
    +                const sub_match<RandomAccessIterator>& m); 
    +

    Effects: returns s + m.str().

    +
    template <class RandomAccessIterator, class traits, class Allocator> 
    +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>
    +    operator + (const sub_match<RandomAccessIterator>& m, 
    +                const std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s); 
    +

    Effects: returns m.str() + s.

    +
    template <class RandomAccessIterator> std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> 
    +    operator + (typename iterator_traits<RandomAccessIterator>::value_type const* s, 
    +                const sub_match<RandomAccessIterator>& m); 
    +

    Effects: returns s + m.str().

    +
    template <class RandomAccessIterator> std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> 
    +    operator + (const sub_match<RandomAccessIterator>& m, 
    +                typename iterator_traits<RandomAccessIterator>::value_type const * s);
    +

    Effects: returns m.str() + s.

    +
    template <class RandomAccessIterator> 
    +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> 
    +    operator + (typename iterator_traits<RandomAccessIterator>::value_type const& s, 
    +                const sub_match<RandomAccessIterator>& m); 
    +

    Effects: returns s + m.str().

    +
    template <class RandomAccessIterator> 
    +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> 
    +    operator + (const sub_match<RandomAccessIterator>& m, 
    +                typename iterator_traits<RandomAccessIterator>::value_type const& s); 
    +

    Effects: returns m.str() + s.

    +
    template <class RandomAccessIterator> 
    +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> 
    +    operator + (const sub_match<RandomAccessIterator>& m1,
    +                const sub_match<RandomAccessIterator>& m2);
    +

    Effects: returns m1.str() + m2.str().

    +
    Stream inserter
    +
    template <class charT, class traits, class BidirectionalIterator>
     basic_ostream<charT, traits>&
        operator << (basic_ostream<charT, traits>& os
                     const sub_match<BidirectionalIterator>& m);
    - -

    - Effects: returns (os << m.str()). +

    + Effects: returns (os << m.str()).


    Revised @@ -422,5 +558,3 @@ basic_ostream<charT, traits>& for any purpose. It is provided "as is" without express or implied warranty.

    - - diff --git a/doc/Attic/thread_safety.html b/doc/Attic/thread_safety.html index eeda681d..20cee284 100644 --- a/doc/Attic/thread_safety.html +++ b/doc/Attic/thread_safety.html @@ -23,6 +23,11 @@


    +

    The regex library is thread safe when Boost is: you can verify that Boost is in + thread safe mode by checking to see if BOOST_HAS_THREADS is defined: this macro + is set automatically by the config system when threading support is turned on + in your compiler. +

    Class basic_regex<> and its typedefs regex and wregex are thread safe, in that compiled regular expressions can safely be shared between threads. The matching algorithms regex_match, @@ -65,4 +70,3 @@ 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 5108c248..1c18ab6d 100644 --- a/doc/basic_regex.html +++ b/doc/basic_regex.html @@ -1,64 +1,46 @@ - -Boost.Regex: basic_regex - - - - - - - - - - - -
    -

    -"C++

    -
    -

    Boost.Regex

    - -

    basic_regex

    -
    -

    -"Boost.Regex

    -
    - -
    -
    - - -
    -

    Synopsis

    - -
    +   
    +      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 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 instances, unless you want to use -custom traits classes or allocators, you won't need to use anything -other than these:

    - -
    +      

    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 + 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 basic_regex;
    @@ -66,12 +48,9 @@ other than these:

    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.

    - -
    +      

    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,
    @@ -112,89 +91,86 @@ public:
        static const regex_constants::syntax_option_type perl = regex_constants::perl;
     
        // construct/copy/destroy:
    -   explicit basic_regex(const Allocator& a = Allocator());
    -   explicit basic_regex(const charT* p, flag_type f = regex_constants::normal,
    +   explicit basic_regex(const Allocator& a = Allocator());
    +   explicit basic_regex(const charT* p, flag_type f = regex_constants::normal,
                             const Allocator& a = Allocator());
    -   basic_regex(const charT* p1, const charT* p2, flag_type f = regex_constants::normal,
    +   basic_regex(const charT* p1, const charT* p2, flag_type f = regex_constants::normal,
                    const Allocator& a = Allocator());
    -   basic_regex(const charT* p, size_type len, flag_type f,
    +   basic_regex(const charT* p, size_type len, flag_type f,
                    const Allocator& a = Allocator());
    -   basic_regex(const basic_regex&);
    +   basic_regex(const basic_regex&);
        template <class ST, class SA>
    -   explicit basic_regex(const basic_string<charT, ST, SA>& p,
    +   explicit basic_regex(const basic_string<charT, ST, SA>& p,
                             flag_type f = regex_constants::normal,
                             const Allocator& a = Allocator());
        template <class InputIterator>
    -   basic_regex(InputIterator first, inputIterator last,
    +   basic_regex(InputIterator first, inputIterator last,
                    flag_type f = regex_constants::normal,
                    const Allocator& a = Allocator());
     
        ~basic_regex();
    -   basic_regex& operator=(const basic_regex&);
    -   basic_regex& operator=(const charT* ptr);
    -   template <class ST, class SA>
    -   basic_regex& operator=(const basic_string<charT, ST, SA>& p);
    -
    -   // iterators:
    -   const_iterator begin() const;
    -   const_iterator end() const;
    -   // capacity:
    -   size_type size() const;
    -   size_type max_size() const;
    -   bool empty() const;
    -   unsigned mark_count() const;
    -
    +   basic_regex& operator=(const basic_regex&);
    +   basic_regex& operator= (const charT* ptr); 
    +   template <class ST, class SA> 
    +   basic_regex& operator= (const basic_string<charT, ST, SA>& p);
    +   // iterators: 
    +   const_iterator begin() const; 
    +   const_iterator end() const;
    +   // capacity: 
    +   size_type size() const; 
    +   size_type max_size() const; 
    +   bool empty() const; 
    +   unsigned mark_count()const; 
        //
    -   // modifiers:
    -   basic_regex& assign(const basic_regex& that);
    -   basic_regex& assign(const charT* ptr, flag_type f = regex_constants::normal);
    -   basic_regex& assign(const charT* first, const charT* last,
    -                       flag_type f = regex_constants::normal);
    +   // modifiers: 
    +   basic_regex& assign(const basic_regex& that); 
    +   basic_regex& assign(const charT* ptr, flag_type f = regex_constants::normal);
    +   basic_regex& assign(const charT* ptr, unsigned int len, flag_type f);
        template <class string_traits, class A>
    -   basic_regex& assign(const basic_string<charT, string_traits, A>& s,
    +   basic_regex& assign(const basic_string<charT, string_traits, A>& s,
                            flag_type f = regex_constants::normal);
        template <class InputIterator>
    -   basic_regex& assign(InputIterator first, InputIterator last,
    +   basic_regex& assign(InputIterator first, InputIterator last,
                            flag_type f = regex_constants::normal);
     
        // const operations:
    -   Allocator get_allocator() const;
    -   flag_type getflags() const;
    -   basic_string<charT> str() const;
    -   int compare(basic_regex&) const;
    +   Allocator get_allocator() const;
    +   flag_type flags() const;
    +   basic_string<charT> str() const;
    +   int compare(basic_regex&) const;
        // locale:
    -   locale_type imbue(locale_type loc);
    -   locale_type getloc() const;
    +   locale_type imbue(locale_type loc);
    +   locale_type getloc() const;
        // swap
    -   void swap(basic_regex&) throw();
    +   void swap(basic_regex&) throw();
     };
     
     template <class charT, class traits, class Allocator>
    -bool operator == (const basic_regex<charT, traits, Allocator>& lhs,
    +bool operator == (const basic_regex<charT, traits, Allocator>& lhs,
                       const basic_regex<charT, traits, Allocator>& rhs);
     template <class charT, class traits, class Allocator>
    -bool operator != (const basic_regex<charT, traits, Allocator>& lhs,
    +bool operator != (const basic_regex<charT, traits, Allocator>& lhs,
                       const basic_regex<charT, traits, Allocator>& rhs);
     template <class charT, class traits, class Allocator>
    -bool operator < (const basic_regex<charT, traits, Allocator>& lhs,
    +bool operator < (const basic_regex<charT, traits, Allocator>& lhs,
                      const basic_regex<charT, traits, Allocator>& rhs);
     template <class charT, class traits, class Allocator>
    -bool operator <= (const basic_regex<charT, traits, Allocator>& lhs,
    +bool operator <= (const basic_regex<charT, traits, Allocator>& lhs,
                       const basic_regex<charT, traits, Allocator>& rhs);
     template <class charT, class traits, class Allocator>
    -bool operator >= (const basic_regex<charT, traits, Allocator>& lhs,
    +bool operator >= (const basic_regex<charT, traits, Allocator>& lhs,
                       const basic_regex<charT, traits, Allocator>& rhs);
     template <class charT, class traits, class Allocator>
    -bool operator > (const basic_regex<charT, traits, Allocator>& lhs,
    +bool operator > (const basic_regex<charT, traits, Allocator>& lhs,
                      const basic_regex<charT, traits, Allocator>& rhs);
     
     template <class charT, class io_traits, class re_traits, class Allocator>
     basic_ostream<charT, io_traits>&
    -   operator << (basic_ostream<charT, io_traits>& os,
    +   operator << (basic_ostream<charT, io_traits>& os,
                     const basic_regex<charT, re_traits, Allocator>& e);
     
     template <class charT, class traits, class Allocator>
    -void swap(basic_regex<charT, traits, Allocator>& e1,
    +void swap(basic_regex<charT, traits, Allocator>& e1,
               basic_regex<charT, traits, Allocator>& e2);
     
     typedef basic_regex<char> regex;
    @@ -202,15 +178,10 @@ typedef basic_regex<wchar_t> wregex;
     
     } // namespace boost
     
    - -

    Description

    - -

    Class basic_regex has the following public member -functions:

    - -

    basic_regex constants

    - -
    +      

    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;
    @@ -227,1067 +198,721 @@ 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 argument is used for any memory allocation -performed by the constructor or member functions during the -lifetime of the object.

    - -
    +      

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

    -
    -
    -
    - -
    +      

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

    -
    -
    -
    - -
    +      

    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)

    +
    +

    flags()

    +
    +

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

    +
    +

    flags()

    +
    +

    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.

    -
    -
    -
    - -
    +      

    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)

    +
    +

    flags()

    +
    +

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

    -
    -
    -
    - -
    +      

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

    +
    +

    flags()

    +
    +

    e.flags()

    +
    +

    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.

    -
    -
    -
    - -
    +      

    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

    +
    +

    flags()

    +
    +

    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.

    -
    -
    -
    - -
    +      

    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)

    +
    +

    flags()

    +
    +

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

    - -
    +      

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

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

    Requires: p shall not be a null pointer.

    - - - -

    Effects: Returns the result of -assign(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

    - -
    +      

    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.

    - -
    +      

    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

    - -
    +      

    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.

    - -
    +      

    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.

    - -
    +      

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

    - -
    +      

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

    - -
    +      

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

    +
    
     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,
    +      

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

    +
    basic_regex& assign(const charT* ptr, unsigned int len, flag_type f);
    +

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

    +
    template <class string_traits, class A>
    +basic_regex& assign(const basic_string<charT, string_traits, A>& s,
                         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.

    -
    -
    -
    - -
    +
    +

    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

    +
    +

    flags()

    +
    +

    f

    +
    +

    mark_count()

    +
    +

    The number of marked sub-expressions within the expression.

    +
    +
    +
    +
      
     
    - -
    -template <class InputIterator>
    +      
    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;
    +      

    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 Allocator that was passed to the object's + constructor.

    +
    flag_type flags() 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 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: 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: If flags() == e.flags() then returns str().compare(e.str()), + otherwise returns flags() - e.flags().

    +

    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.

    - -
    +      

    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

    - -
    +      

    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 
    - -
    +      

    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 
    +

    Comparisons between basic_regex objects are provided on an experimental basis: + please note that these are likely to be removed from the standard library + proposal, so use with care if you are writing portable code.

    +
    
     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.

    - -
    +      

    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.

    - -
    +      

    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.

    - -
    +      

    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.

    - -
    +      

    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.

    - -
    +      

    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.
    - -
    +      

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

    +
    basic_regex inserter.
    +

    The basic_regex stream inserter is provided on an experimental basis, and + outputs the textual representation of the expression to the stream:

    +
    
     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
    - -
    +      

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

    - -
    -

    Revised - -17 May 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.

    - +

    Effects: calls lhs.swap(rhs).

    +
    +

    Revised + + 17 May 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 2f12281e..e24e93ac 100644 --- a/doc/contacts.html +++ b/doc/contacts.html @@ -1,110 +1,85 @@ - -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 -17 May 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

    +
    +

    Boost.Regex

    +

    Contacts and Acknowledgements

    +
    +

    Boost.Regex Index

    +
    +
    +
    +
    +

    The author can be contacted at john@johnmaddock.co.uk; the + home page for this library is at www.boost.org.

    +

    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:

    +

    Short tutorials on regular expressions can be + found here and here.

    +

    The main book on regular expressions is + Mastering Regular Expressions, published by O'Reilly.

    +

    Information on the + Boost.regex standardization proposal, along with other + standard library extension proposals can be found on the + C++ Committees web pages.

    +

    TheOpen 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 + + 17 May 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/history.html b/doc/history.html index 17ca695c..36eb7ac7 100644 --- a/doc/history.html +++ b/doc/history.html @@ -27,17 +27,20 @@

    Boost 1.31.0.

    • - Completely rewritten pattern matching code - it is now up to 10 times faster - than before.
    • + Completely rewritten pattern matching code - it is now up to 10 times faster + than before.
    • - Reorganized documentation.
    • + Reorganized documentation.
    • Deprecated all interfaces that are not part of the - regular expression standardization proposal.
    • + regular expression standardization proposal.
    • - Added regex_iterator and regex_token_iterator.
    • + Added regex_iterator and regex_token_iterator.
    • - Added support for Perl style independent sub-expressions.
    + Added support for Perl style independent sub-expressions. +
  • + Added non-member operators to the sub_match class, so that you can compare + sub_match's with strings, or add them to a string to produce a new string.

  • @@ -55,4 +58,3 @@ for any purpose. It is provided "as is" without express or implied warranty.

    - diff --git a/doc/introduction.html b/doc/introduction.html index cd00847a..1e48bf9e 100644 --- a/doc/introduction.html +++ b/doc/introduction.html @@ -62,7 +62,7 @@ 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}

    +
    (\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++ @@ -93,8 +93,9 @@ 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 - algorithm regex_replace, for our credit card example we can write two algorithms - like this to provide the format conversions:

    + algorithm regex_replace, for our credit card + example we can write two algorithms like this to provide the format + conversions:

    // match any format with the regular expression:
     const boost::regex e("\\A(\\d{3,4})[- ]?(\\d{4})[- ]?(\\d{4})[- ]?(\\d{4})\\z");
     const std::string machine_format("\\1\\2\\3\\4");
    @@ -126,22 +127,31 @@ std::string human_readable_card_number(const std::string s)
     typedef match_results<std::string::const_iterator> smatch;
     typedef match_results<std::wstring::const_iterator> wsmatch; 
     }
    -

    The algorithms regex_search and - regex_grep (i.e. finding all matches in a string) make use of - match_results to report what matched.

    +

    The algorithms regex_search and regex_match + make use of match_results to report what matched; the difference between these + algorithms is that regex_match will only find + matches that consume all of the input text, where as + regex_search will search for a match anywhere within the text + being matched.

    Note that these algorithms are not restricted to searching regular C-strings, any bidirectional iterator type can be searched, allowing for the possibility of seamlessly searching almost any kind of data.

    -

    For search and replace operations in addition to the algorithm - regex_replace that we have already seen, the algorithm - regex_format takes the result of a match and a format string, and - produces a new string by merging the two.

    +

    For search and replace operations, in addition to the algorithm + regex_replace that we have already seen, the match_results + class has a format member that takes the result of a match and a format string, + and produces a new string by merging the two.

    +

    For iterating through all occurences of an expression within a text, there are + two iterator types: regex_iterator will + enumerate over the match_results objects + found, while regex_token_iterator will + enumerate a series of strings (similar to perl style split operations).

    For those that dislike templates, there is a high level wrapper class RegEx that is an encapsulation of the lower level template code - it provides a simplified interface for those that don't need the full power of the library, and supports only narrow characters, and the "extended" regular expression - syntax. + syntax. This class is now deprecated as it does not form part of the regular + expressions C++ standard library proposal.

    The POSIX API functions: regcomp, regexec, regfree and regerror, are available in both narrow character and Unicode versions, and @@ -162,7 +172,7 @@ std::string human_readable_card_number(const std::string s) 17 May 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 @@ -171,6 +181,3 @@ std::string human_readable_card_number(const std::string s) for any purpose. It is provided "as is" without express or implied warranty.

    - - - diff --git a/doc/match_flag_type.html b/doc/match_flag_type.html index 0e89736a..3e5b3485 100644 --- a/doc/match_flag_type.html +++ b/doc/match_flag_type.html @@ -1,46 +1,36 @@ - - -Boost.Regex: match_flag_type - - - - -

    - - - - - - - -
    -

    -"C++

    -
    -

    Boost.Regex

    - -

    match_flag_type

    -
    -

    -"Boost.Regex

    -
    - -
    -
    - - -
    -

    Synopsis

    - -

    The type match_flag_type is an implementation -defined bitmask type (17.3.2.1.2) that controls how a regular -expression is matched against a character sequence.

    - -
    +   
    +      Boost.Regex: match_flag_type
    +      
    +      
    +      
    +   
    +   
    +      

    + + + + + + +
    +

    C++ Boost

    +
    +

    Boost.Regex

    +

    match_flag_type

    +
    +

    Boost.Regex Index

    +
    +
    +
    +
    +

    Synopsis

    +

    The type match_flag_type is an implementation defined bitmask type + (17.3.2.1.2) that controls how a regular expression is matched against a + character sequence.  The behavior of the format flags is descibed in more + detail in the format syntax guide.

    +
     namespace std{ namespace regex_constants{
     
     typedef bitmask_type match_flag_type;
    @@ -70,261 +60,213 @@ static const match_flag_type format_all;
     } // namespace regex_constants
     } // namespace std
     
    - -

    Description

    - -

    The type match_flag_type is an implementation -defined bitmask type (17.3.2.1.2). When matching a regular -expression against a sequence of characters [first, last) then -setting its elements has the effects listed in the table below:

    - -

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

    Element

    -
    -

    Effect if set

    -
    -

    match_default

    -
    -

    Specifies that matching of regular expressions proceeds without -any modification of the normal rules used in ECMA-262, ECMAScript -Language Specification, Chapter 15 part 10, RegExp (Regular -Expression) Objects (FWD.1)

    -
    match_not_bobSpecifies that the expression "\A" -should not match against the sub-sequence [first,first).
    match_not_eobSpecifies that the expressions "\z" -and "\Z" should not match against the sub-sequence -[last,last).
    -

    match_not_bol

    -
    -

    Specifies that the expression "^" should not be matched against -the sub-sequence [first,first).

    -
    -

    match_not_eol

    -
    -

    Specifies that the expression "$" should not be matched against -the sub-sequence [last,last).

    -
    -

    match_not_bow

    -
    -

    Specifies that the expression "\b" should not be matched against -the sub-sequence [first,first).

    -
    -

    match_not_eow

    -
    -

    Specifies that the expression "\b" should not be matched against -the sub-sequence [last,last).

    -
    -

    match_any

    -
    -

    Specifies that if more than one match is possible then any match -is an acceptable result.

    -
    -

    match_not_null

    -
    -

    Specifies that the expression can not be matched against an -empty sequence.

    -
    -

    match_continuous

    -
    -

    Specifies that the expression must match a sub-sequence that -begins at first.

    -
    -

    match_partial

    -
    -

    Specifies that if no match can be found, then it is acceptable -to return a match [from, last) where from!=last, if there exists -some sequence of characters [from,to) of which [from,last) is a -prefix, and which would result in a full match.

    -
    -

    match_prev_avail

    -
    -

    Specifies that --first is a valid iterator -position, when this flag is set then the flags -match_not_bol and match_not_bow are ignored by -the regular expression algorithms (RE.7) and iterators (RE.8).

    -
    match_not_dot_newlineSpecifies that the expression "." does -not match a newline character.
    match_not_dot_nullSpecified that the expression "." does -not match a character null '\0'.
    -

    format_default

    -
    -

    Specifies that when a regular expression match is to be replaced -by a new string, that the new string is constructed using the rules -used by the ECMAScript replace function in ECMA-262, ECMAScript -Language Specification, Chapter 15 part 5.4.11 -String.prototype.replace. (FWD.1). In addition during search and -replace operations then all non-overlapping occurrences of the -regular expression are located and replaced, and sections of the -input that did not match the expression, are copied unchanged to -the output string.

    -
    -

    format_sed

    -
    -

    Specifies that when a regular expression match is to be replaced -by a new string, that the new string is constructed using the rules -used by the Unix sed utility in IEEE Std 1003.1-2001, Portable -Operating SystemInterface (POSIX ), Shells and Utilities..

    -
    -

    format_perl

    -
    -

    Specifies that when a regular expression match is to be replaced -by a new string, that the new string is constructed using an -implementation defined superset of the rules used by the ECMAScript -replace function in ECMA-262, ECMAScript Language Specification, -Chapter 15 part 5.4.11 String.prototype.replace (FWD.1).

    -
    format_allSpecifies that all syntax -extensions are enabled, including conditional -(?ddexpression1:expression2) replacements.
    -

    format_no_copy

    -
    -

    When specified during a search and replace operation, then -sections of the character container sequence being searched that do -match the regular expression, are not copied to the output -string.

    -
    -

    format_first_only

    -
    -

    When specified during a search and replace operation, then only -the first occurrence of the regular expression is replaced.

    -
    - -
    -
    - - -

    - -
    -
    -
    - - -

    Revised - -17 May 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.

    - +

    Description

    +

    The type match_flag_type is an implementation defined bitmask type + (17.3.2.1.2). When matching a regular expression against a sequence of + characters [first, last) then setting its elements has the effects listed in + the table below:

    +

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

    Element

    +
    +

    Effect if set

    +
    +

    match_default

    +
    +

    Specifies that matching of regular expressions proceeds without any + modification of the normal rules used in ECMA-262, ECMAScript Language + Specification, Chapter 15 part 10, RegExp (Regular Expression) Objects (FWD.1)

    +
    match_not_bobSpecifies that the expression "\A" should not match + against the sub-sequence [first,first).
    match_not_eobSpecifies that the expressions "\z" and + "\Z" should not match against the sub-sequence [last,last).
    +

    match_not_bol

    +
    +

    Specifies that the expression "^" should not be matched against the + sub-sequence [first,first).

    +
    +

    match_not_eol

    +
    +

    Specifies that the expression "$" should not be matched against the + sub-sequence [last,last).

    +
    +

    match_not_bow

    +
    +

    Specifies that the expression "\b" should not be matched against the + sub-sequence [first,first).

    +
    +

    match_not_eow

    +
    +

    Specifies that the expression "\b" should not be matched against the + sub-sequence [last,last).

    +
    +

    match_any

    +
    +

    Specifies that if more than one match is possible then any match is an + acceptable result.

    +
    +

    match_not_null

    +
    +

    Specifies that the expression can not be matched against an empty sequence.

    +
    +

    match_continuous

    +
    +

    Specifies that the expression must match a sub-sequence that begins at first.

    +
    +

    match_partial

    +
    +

    Specifies that if no match can be found, then it is acceptable to return a + match [from, last) where from!=last, if there exists some sequence of + characters [from,to) of which [from,last) is a prefix, and which would result + in a full match.

    +
    +

    match_prev_avail

    +
    +

    Specifies that --first is a valid iterator position, when this + flag is set then the flags match_not_bol and match_not_bow + are ignored by the regular expression algorithms (RE.7) and iterators (RE.8).

    +
    match_not_dot_newlineSpecifies that the expression "." does not match a + newline character.
    match_not_dot_nullSpecified that the expression "." does not match a + character null '\0'.
    +

    format_default

    +
    +

    Specifies that when a regular expression match is to be replaced by a new + string, that the new string is constructed using the rules used by the + ECMAScript replace function in ECMA-262, ECMAScript Language Specification, + Chapter 15 part 5.4.11 String.prototype.replace. (FWD.1). In addition during + search and replace operations then all non-overlapping occurrences of the + regular expression are located and replaced, and sections of the input that did + not match the expression, are copied unchanged to the output string.

    +
    +

    format_sed

    +
    +

    Specifies that when a regular expression match is to be replaced by a new + string, that the new string is constructed using the rules used by the Unix sed + utility in IEEE Std 1003.1-2001, Portable Operating SystemInterface (POSIX ), + Shells and Utilities..

    +
    +

    format_perl

    +
    +

    + Specifies that when a regular expression match is to be replaced by a new + string, that the new string is constructed using the same rules as Perl 5.

    +
    format_allSpecifies that all syntax extensions are + enabled, including conditional (?ddexpression1:expression2) replacements: see + the format string guide for more details.
    +

    format_no_copy

    +
    +

    When specified during a search and replace operation, then sections of the + character container sequence being searched that do match the regular + expression, are not copied to the output string.

    +
    +

    format_first_only

    +
    +

    When specified during a search and replace operation, then only the first + occurrence of the regular expression is replaced.

    +
    +
    +
    +

    +
    +
    +
    +

    Revised + + 17 May 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/match_results.html b/doc/match_results.html index 9c2d3c64..d3022f84 100644 --- a/doc/match_results.html +++ b/doc/match_results.html @@ -1,77 +1,57 @@ - - -Boost.Regex: class match_results - - - - -

    - - - - - - - -
    -

    -"C++

    -
    -

    Boost.Regex

    - -

    class match_results

    -
    -

    -"Boost.Regex

    -
    - -
    -
    - - -
    -

    Contents

    - -
    -
    Synopsis
    - -
    Description
    -
    - -

    Synopsis

    - -

    #include <boost/regex.hpp>

    - -

    Regular expressions are different from many simple -pattern-matching algorithms in that as well as finding an overall -match they can also produce sub-expression matches: each -sub-expression being delimited in the pattern by a pair of -parenthesis (...). There has to be some method for reporting -sub-expression matches back to the user: this is achieved this by -defining a class match_results that acts as an indexed -collection of sub-expression matches, each sub-expression match -being contained in an object of type -sub_match .

    - -

    Template class match_results denotes a collection of character -sequences representing the result of a regular expression match. -Objects of type match_results are passed to the algorithms regex_match and -regex_search, and are returned by the iterator regex_iterator .  Storage for the -collection is allocated and freed as necessary by the member -functions of class match_results.

    - -

    The template class match_results conforms to the requirements of -a Sequence, as specified in (lib.sequence.reqmts), except that only -operations defined for const-qualified Sequences are supported.

    - -

    Class template match_results is most commonly used as one of the -typedefs cmatch, wcmatch, smatch, or wsmatch:

    - -
    +   
    +      Boost.Regex: class match_results
    +      
    +      
    +      
    +   
    +   
    +      

    + + + + + + +
    +

    C++ Boost

    +
    +

    Boost.Regex

    +

    class match_results

    +
    +

    Boost.Regex Index

    +
    +
    +
    +
    +

    Contents

    +
    +
    Synopsis
    Description
    +
    +

    Synopsis

    +

    #include <boost/regex.hpp>

    +

    Regular expressions are different from many simple pattern-matching algorithms + in that as well as finding an overall match they can also produce + sub-expression matches: each sub-expression being delimited in the pattern by a + pair of parenthesis (...). There has to be some method for reporting + sub-expression matches back to the user: this is achieved this by defining a + class match_results that acts as an indexed collection of sub-expression + matches, each sub-expression match being contained in an object of type + sub_match .

    +

    Template class match_results denotes a collection of character sequences + representing the result of a regular expression match. Objects of type + match_results are passed to the algorithms regex_match + and regex_search, and are returned by the + iterator regex_iterator .  Storage for + the collection is allocated and freed as necessary by the member functions of + class match_results.

    +

    The template class match_results conforms to the requirements of a Sequence, as + specified in (lib.sequence.reqmts), except that only operations defined for + const-qualified Sequences are supported.

    +

    Class template match_results is most commonly used as one of the typedefs + cmatch, wcmatch, smatch, or wsmatch:

    +
     template <class BidirectionalIterator,
               class Allocator = allocator<sub_match<BidirectionalIterator> >
     class match_results;
    @@ -98,414 +78,354 @@ public:
        typedef          basic_string<char_type>                                 string_type;
     
        // construct/copy/destroy:
    -   explicit match_results(const Allocator& a = Allocator());
    -   match_results(const match_results& m);
    -   match_results& operator=(const match_results& m); 
    +   explicit match_results(const Allocator& a = Allocator());
    +   match_results(const match_results& m);
    +   match_results& operator=(const match_results& m); 
        ~match_results();
     
        // size:
    -   size_type size() const;
    -   size_type max_size() const;
    -   bool empty() const;
    +   size_type size() const;
    +   size_type max_size() const;
    +   bool empty() const;
        // element access:
    -   difference_type length(int sub = 0) const;
    -   difference_type position(unsigned int sub = 0) const;
    -   string_type str(int sub = 0) const;
    -   const_reference operator[](int n) const;
    +   difference_type length(int sub = 0) const;
    +   difference_type position(unsigned int sub = 0) const;
    +   string_type str(int sub = 0) const;
    +   const_reference operator[](int n) const;
     
    -   const_reference prefix() const;
    +   const_reference prefix() const;
     
    -   const_reference suffix() const;
    -   const_iterator begin() const;
    -   const_iterator end() const;
    +   const_reference suffix() const;
    +   const_iterator begin() const;
    +   const_iterator end() const;
        // format:
        template <class OutputIterator>
    -   OutputIterator format(OutputIterator out,
    +   OutputIterator format(OutputIterator out,
                              const string_type& fmt,
                              match_flag_type flags = format_default) const;
    -   string_type format(const string_type& fmt,
    +   string_type format(const string_type& fmt,
                           match_flag_type flags = format_default) const;
     
    -   allocator_type get_allocator() const;
    -   void swap(match_results& that);
    +   allocator_type get_allocator() const;
    +   void swap(match_results& that);
     };
     
     template <class BidirectionalIterator, class Allocator>
    -bool operator == (const match_results<BidirectionalIterator, Allocator>& m1,
    +bool operator == (const match_results<BidirectionalIterator, Allocator>& m1,
                       const match_results<BidirectionalIterator, Allocator>& m2);
     template <class BidirectionalIterator, class Allocator>
    -bool operator != (const match_results<BidirectionalIterator, Allocator>& m1,
    +bool operator != (const match_results<BidirectionalIterator, Allocator>& m1,
                       const match_results<BidirectionalIterator, Allocator>& m2);
     
     template <class charT, class traits, class BidirectionalIterator, class Allocator>
     basic_ostream<charT, traits>&
    -   operator << (basic_ostream<charT, traits>& os,
    +   operator << (basic_ostream<charT, traits>& os,
                     const match_results<BidirectionalIterator, Allocator>& m);
     
     template <class BidirectionalIterator, class Allocator>
    -void swap(match_results<BidirectionalIterator, Allocator>& m1,
    +void swap(match_results<BidirectionalIterator, Allocator>& m1,
               match_results<BidirectionalIterator, Allocator>& m2);
     
    - -

    Description

    - -

    match_results constructors

    - -

    In all match_results 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.

    - -
    +      

    Description

    +

    match_results constructors

    +

    In all match_results 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.

    +
    
     match_results(const Allocator& a = Allocator());
     
    - - -

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

    - -

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

    Element

    -
    -

    Value

    -
    -

    empty()

    -
    -

    true

    -
    -

    size()

    -
    -

    0

    -
    -

    str()

    -
    -

    basic_string<charT>()

    -
    -
    - -

     

    - -
    +      
    +      

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

    +

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

    Element

    +
    +

    Value

    +
    +

    empty()

    +
    +

    true

    +
    +

    size()

    +
    +

    0

    +
    +

    str()

    +
    +

    basic_string<charT>()

    +
    +
    +

     

    +
    
     match_results(const match_results& m);
     
    - - -

    Effects: Constructs an object of class match_results, as -a copy of m.

    - -
    +      
    +      

    Effects: Constructs an object of class match_results, as a copy of m.

    +
    
     match_results& operator=(const match_results& m);
     
    - - -

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

    - -

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

    Element

    -
    -

    Value

    -
    -

    empty()

    -
    -

    m.empty().

    -
    -

    size()

    -
    -

    m.size().

    -
    -

    str(n)

    -
    -

    m.str(n) for all integers n < m.size().

    -
    -

    prefix()

    -
    -

    m.prefix().

    -
    -

    suffix()

    -
    -

    m.suffix().

    -
    -

    (*this)[n]

    -
    -

    m[n] for all integers n < m.size().

    -
    -

    length(n)

    -
    -

    m.length(n) for all integers n < m.size().

    -
    -

    position(n)

    -
    -

    m.position(n) for all integers n < m.size().

    -
    -
    - -

    match_results size

    - -
    +      
    +      

    Effects: Assigns m to *this. The postconditions of this function are + indicated in the table:

    +

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

    Element

    +
    +

    Value

    +
    +

    empty()

    +
    +

    m.empty().

    +
    +

    size()

    +
    +

    m.size().

    +
    +

    str(n)

    +
    +

    m.str(n) for all integers n < m.size().

    +
    +

    prefix()

    +
    +

    m.prefix().

    +
    +

    suffix()

    +
    +

    m.suffix().

    +
    +

    (*this)[n]

    +
    +

    m[n] for all integers n < m.size().

    +
    +

    length(n)

    +
    +

    m.length(n) for all integers n < m.size().

    +
    +

    position(n)

    +
    +

    m.position(n) for all integers n < m.size().

    +
    +
    +

    match_results size

    +
    
     size_type size()const;
     
    - - -

    Effects: Returns the number of sub_match elements stored -in *this.

    - -
    +      
    +      

    Effects: Returns the number of sub_match elements stored in *this; that + is the number of marked sub-expressions in the regular expression that was + matched plus one.

    +
    
     size_type max_size()const;
     
    - - -

    Effects: Returns the maximum number of sub_match elements -that can be stored in *this.

    - -
    +      
    +      

    Effects: Returns the maximum number of sub_match elements that can be + stored in *this.

    +
    
     bool empty()const;
     
    - - -

    Effects: Returns size() == 0.

    - -

    match_results element access

    - -
    +      
    +      

    Effects: Returns size() == 0.

    +

    match_results element access

    +
    
     difference_type length(int sub = 0)const;
     
    - - -

    Effects: Returns (*this)[sub].length().

    - -
    +      
    +      

    Effects: Returns the length of sub-expression sub, that is to + say: (*this)[sub].length().

    +
    
     difference_type position(unsigned int sub = 0)const;
     
    - - -

    Effects: Returns std::distance(prefix().first, -(*this)[sub].first).

    - -
    +      
    +      

    Effects: Returns the starting location of sub-expression sub, + or -1 if sub was not matched .

    +
    
     string_type str(int sub = 0)const;
     
    - - -

    Effects: Returns -string_type((*this)[sub]).

    - -
    +      
    +      

    Effects: Returns sub-expression sub as a string:  string_type((*this)[sub]).

    +
    
     const_reference operator[](int n) const;
     
    - - -

    Effects: Returns a reference to the -sub_match object representing the character sequence that -matched marked sub-expression n. If n == 0 then -returns a reference to a sub_match object representing -the character sequence that matched the whole regular -expression.

    - -
    +      
    +      

    Effects: Returns a reference to the sub_match object + representing the character sequence that matched marked sub-expression n. + If n == 0 then returns a reference to a sub_match object + representing the character sequence that matched the whole regular + expression.  If n is out of range, or if n is an + unmatched sub-expression, then returns a sub_match object whose matched + member is false.

    +
    
     const_reference prefix()const;
     
    - - -

    Effects: Returns a reference to the -sub_match object representing the character sequence from -the start of the string being matched/searched, to the start of the -match found.

    - -
    +      
    +      

    Effects: Returns a reference to the sub_match object + representing the character sequence from the start of the string being + matched/searched, to the start of the match found.

    +
    
     const_reference suffix()const;
     
    - - -

    Effects: Returns a reference to the -sub_match object representing the character sequence from -the end of the match found to the end of the string being -matched/searched.

    - -
    +      
    +      

    Effects: Returns a reference to the sub_match object + representing the character sequence from the end of the match found to the end + of the string being matched/searched.

    +
    
     const_iterator begin()const;
     
    - - -

    Effects: Returns a starting iterator that enumerates over -all the marked sub-expression matches stored in *this.

    - -
    +      
    +      

    Effects: Returns a starting iterator that enumerates over all the marked + sub-expression matches stored in *this.

    +
    
     const_iterator end()const;
     
    - - -

    Effects: Returns a terminating iterator that enumerates -over all the marked sub-expression matches stored in *this.

    - -

    match_results reformatting

    - -
    +      
    +      

    Effects: Returns a terminating iterator that enumerates over all the + marked sub-expression matches stored in *this.

    +

    match_results reformatting

    +
    
     template <class OutputIterator>
     OutputIterator format(OutputIterator out,
                           const string_type& fmt,
                           match_flag_type flags = format_default);
     
    - - -

    Requires: The type OutputIterator conforms to the Output -Iterator requirements (24.1.2).

    - - -

    Effects: Copies the character sequence [fmt.begin(), -fmt.end()) to OutputIterator out. For each format -specifier or escape sequence in fmt, replace that sequence -with either the character(s) it represents, or the sequence of -characters within *this to which it refers. The bitmasks specified -in flags determines what -format specifiers or escape sequences -are recognized, by default this is the format used by ECMA-262, -ECMAScript Language Specification, Chapter 15 part 5.4.11 -String.prototype.replace.

    - - -

    Returns: out.

    - -
    +      
    +      

    Requires: The type OutputIterator conforms to the Output Iterator + requirements (24.1.2).

    + +

    Effects: Copies the character sequence [fmt.begin(), fmt.end()) to + OutputIterator out. For each format specifier or escape sequence in fmt, + replace that sequence with either the character(s) it represents, or the + sequence of characters within *this to which it refers. The bitmasks specified + in flags determines what + format specifiers or escape sequences are recognized, by default this is + the format used by ECMA-262, ECMAScript Language Specification, Chapter 15 part + 5.4.11 String.prototype.replace.

    + +

    Returns: out.

    +
    
     string_type format(const string_type& fmt,
                        match_flag_type flags = format_default);
     
    - - -

    Effects: Returns a copy of the string fmt. For -each format specifier or escape sequence in fmt, replace -that sequence with either the character(s) it represents, or the -sequence of characters within *this to which it refers. The -bitmasks specified in -flags determines what format -specifiers or escape sequences are recognized, by default this -is the format used by ECMA-262, ECMAScript Language Specification, -Chapter 15 part 5.4.11 String.prototype.replace.

    - -
    +      
    +      

    Effects: Returns a copy of the string fmt. For each format + specifier or escape sequence in fmt, replace that sequence with either + the character(s) it represents, or the sequence of characters within *this to + which it refers. The bitmasks specified in flags + determines what format specifiers or escape sequences + are recognized, by default this is the format used by ECMA-262, + ECMAScript Language Specification, Chapter 15 part 5.4.11 + String.prototype.replace.

    +
    
     allocator_type get_allocator()const;
     
    - - -

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

    - -
    +      
    +      

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

    +
    
     void swap(match_results& that);
     
    - - -

    Effects: Swaps the contents of the two sequences.

    - - -

    Postcondition: *this contains the sequence -of matched sub-expressions that were in that, -that contains the sequence of matched sub-expressions that -were in *this.

    - - -

    Complexity: constant time.

    - -

    - -
    -

    Revised - -17 May 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.

    - + +

    Effects: Swaps the contents of the two sequences.

    + +

    Postcondition: *this contains the sequence of matched + sub-expressions that were in that, that contains the + sequence of matched sub-expressions that were in *this.

    + +

    Complexity: constant time.

    +

    match_results non-members

    +
    template <class BidirectionalIterator, class Allocator>
    +bool operator == (const match_results<BidirectionalIterator, Allocator>& m1,
    +                  const match_results<BidirectionalIterator, Allocator>& m2);
    +

    Effects: Compares the two sequences for equality.

    +
    template <class BidirectionalIterator, class Allocator>
    +bool operator != (const match_results<BidirectionalIterator, Allocator>& m1,
    +                  const match_results<BidirectionalIterator, Allocator>& m2);
    +

    Effects: Compares the two sequences for inequality.

    +
    template <class charT, class traits, class BidirectionalIterator, class Allocator>
    +basic_ostream<charT, traits>&
    +   operator << (basic_ostream<charT, traits>& os,
    +                const match_results<BidirectionalIterator, Allocator>& m);
    +

    Effects: Writes the contents of m to the stream os as + if by calling os << m.str(); Returns os..

    +
    template <class BidirectionalIterator, class Allocator>
    +void swap(match_results<BidirectionalIterator, Allocator>& m1,
    +          match_results<BidirectionalIterator, Allocator>& m2);
    +

    Effects: Swaps the contents of the two sequences.

    +

    +
    +

    Revised + + 17 May 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/redistributables.html b/doc/redistributables.html index f40f40f4..6a0c7134 100644 --- a/doc/redistributables.html +++ b/doc/redistributables.html @@ -25,14 +25,15 @@

    If you are using Microsoft or Borland C++ and link to a dll version of the run - time library, then you will also link to one of the dll versions of - boost.regex. While these dll's are redistributable, there are no "standard" - versions, so when installing on the users PC, you should place these in a - directory private to your application, and not in the PC's directory path. Note - that if you link to a static version of your run time library, then you will - also link to a static version of boost.regex and no dll's will need to be - distributed. The possible boost.regex dll and library names are computed - according to the following formula:
    + time library, then you can choose to also link to a dll version of boost.regex + by defining the symbol BOOST_REGEX_DYN_LINK when you compile your code. While + these dll's are redistributable, there are no "standard" versions, so when + installing on the users PC, you should place these in a directory private to + your application, and not in the PC's directory path. Note that if you link to + a static version of your run time library, then you will also link to a static + version of boost.regex and no dll's will need to be distributed. The possible + boost.regex dll and library names are computed according to the following + formula:

    BOOST_LIB_PREFIX
    diff --git a/doc/regex_iterator.html b/doc/regex_iterator.html index 4a24769b..bacc0e0e 100644 --- a/doc/regex_iterator.html +++ b/doc/regex_iterator.html @@ -42,40 +42,39 @@ template <class BidirectionalIterator, class regex_iterator { public: - typedef basic_regex<charT, traits, Allocator> regex_type; - typedef match_results<BidirectionalIterator> value_type; + typedef basic_regex<charT, traits, Allocator> regex_type; + typedef match_results<BidirectionalIterator> value_type; typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type; typedef const value_type* pointer; typedef const value_type& reference; typedef std::forward_iterator_tag iterator_category; - regex_iterator(); - regex_iterator(BidirectionalIterator a, BidirectionalIterator b, + regex_iterator(); + regex_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, - match_flag_type m = match_default); - regex_iterator(const regex_iterator&); - regex_iterator& operator=(const regex_iterator&); - bool operator==(const regex_iterator&); - bool operator!=(const regex_iterator&); - const value_type& operator*(); - const value_type* operator->(); - regex_iterator& operator++(); - regex_iterator operator++(int); + match_flag_type m = match_default); + regex_iterator(const regex_iterator&); + regex_iterator& operator=(const regex_iterator&); + bool operator==(const regex_iterator&)const; + bool operator!=(const regex_iterator&)const; + const value_type& operator*()const; + const value_type* operator->()const; + regex_iterator& operator++(); + regex_iterator operator++(int); };

    Description

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

    -
    +      
    
     regex_iterator();
     

    Effects: constructs an end of sequence regex_iterator.

    -
    -regex_iterator(BidirectionalIterator a, BidirectionalIterator b, 
    +      
    regex_iterator(BidirectionalIterator a, BidirectionalIterator b, 
                    const regex_type& re, 
    -               match_flag_type m = match_default);
    +               match_flag_type m = match_default);
     

    Effects: constructs a regex_iterator that will enumerate all occurrences @@ -88,32 +87,32 @@ regex_iterator(BidirectionalIterator a, BidirectionalIterator b, Boost.regex is configured in recursive mode), or if the matcher exhausts it's permitted memory allocation (if Boost.regex is configured in non-recursive mode).

    -
    +      
    
     regex_iterator(const regex_iterator& that);
     

    Effects: constructs a copy of that.

    Postconditions: *this == that.

    -
    +      
    
     regex_iterator& operator=(const regex_iterator&);
     

    Effects: sets *this equal to those in that.

    Postconditions: *this == that.

    -
    -bool operator==(const regex_iterator& that);
    +      
    
    +bool operator==(const regex_iterator& that)const;
     

    Effects: returns true if *this is equal to that.

    -
    -bool operator!=(const regex_iterator&);
    +      
    
    +bool operator!=(const regex_iterator&)const;
     

    Effects: returns !(*this == that).

    -
    -const value_type& operator*();
    +      
    
    +const value_type& operator*()const;
     

    Effects: dereferencing a regex_iterator object it yields a const reference to a match_results object, @@ -159,7 +158,8 @@ const value_type& operator*();

    (*it).prefix().last

    -

    (*it)[0].first

    +

    The same as the start of the match found:
    + (*it)[0].first

    @@ -167,7 +167,8 @@ const value_type& operator*();

    (*it).prefix().matched

    -

    (*it).prefix().first != (*it).prefix().second

    +

    True if the prefix did not match an empty string:
    + (*it).prefix().first != (*it).prefix().second

    @@ -175,7 +176,8 @@ const value_type& operator*();

    (*it).suffix().first

    -

    (*it)[0].second

    +

    The same as the end of the match found:
    + (*it)[0].second

    @@ -191,7 +193,8 @@ const value_type& operator*();

    (*it).suffix().matched

    -

    (*it).suffix().first != (*it).suffix().second

    +

    True if the suffix did not match an empty string:
    + (*it).suffix().first != (*it).suffix().second

    @@ -259,12 +262,12 @@ const value_type& operator*();

    -
    -const value_type* operator->();
    +      
    
    +const value_type* operator->()const;
     

    Effects: returns &(*this).

    -
    +      
    
     regex_iterator& operator++();
     

    Effects: moves the iterator to the next match in the @@ -282,7 +285,7 @@ regex_iterator& operator++(); configured in non-recursive mode).

    Returns: *this.

    -
    +      
    
     regex_iterator operator++(int);
     
    diff --git a/doc/regex_match.html b/doc/regex_match.html index 309d33d4..53a0dfad 100644 --- a/doc/regex_match.html +++ b/doc/regex_match.html @@ -31,47 +31,53 @@

    Synopsis

    #include <boost/regex.hpp> 
    -

    The algorithm regex _match determines whether a given regular expression - matches a given sequence denoted by a pair of bidirectional-iterators, the - algorithm is defined as follows, note that the result is true only if the - expression matches the whole of the input sequence, the main use of - this function is data input validation. +

    + The algorithm regex _match determines whether a given regular expression + matches all of a given character sequence denoted by a pair of + bidirectional-iterators, the algorithm is defined as follows, the main use of + this function is data input validation. +

    Note that the result is true only if the expression matches the whole of + the input sequence.  If you want to search for an expression + somewhere within the sequence then use regex_search.  + If you want to match a prefix of the character string then use + regex_search with the flag match_continuous + set.

    template <class BidirectionalIterator, class Allocator, class charT,
               class traits, class Allocator2>
    -bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
    +bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
                      match_results<BidirectionalIterator, Allocator>& m,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);
                      
     template <class BidirectionalIterator, class charT, class traits, class Allocator2>
    -bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
    +bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);
                      
     template <class charT, class Allocator, class traits, class Allocator2>
    -bool regex_match(const charT* str, match_results<const charT*, Allocator>& m,
    +bool regex_match(const charT* str, match_results<const charT*, Allocator>& m,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);
                      
     template <class ST, class SA, class Allocator, class charT,
               class traits, class Allocator2>
    -bool regex_match(const basic_string<charT, ST, SA>& s,
    +bool regex_match(const basic_string<charT, ST, SA>& s,
                      match_results<typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m, 
                      const basic_regex<charT, traits, Allocator2>& e, 
                      match_flag_type flags = match_default);
                      
     template <class charT, class traits, class Allocator2>
    -bool regex_match(const charT* str,
    +bool regex_match(const charT* str,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);
                      
     template <class ST, class SA, class charT, class traits, class Allocator2>
    -bool regex_match(const basic_string<charT, ST, SA>& s,
    +bool regex_match(const basic_string<charT, ST, SA>& s,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);
     

    Description

    -
    template <class BidirectionalIterator, class Allocator, class charT,
    +         
    template <class BidirectionalIterator, class Allocator, class charT,
               class traits, class Allocator2>
     bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
                      match_results<BidirectionalIterator, Allocator>& m,
    @@ -84,9 +90,9 @@ bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
                 flags is used to control how the expression 
                 is matched against the character sequence. Returns true if such a match 
              exists, false otherwise.

    -

    Throws: std::runtime_error if the complexity of matching the - expression against an N character string begins to exceed O(N2), or - if the program runs out of stack space while matching the expression (if +

    Throws: std::runtime_error if the complexity of + matching the expression against an N character string begins to exceed O(N2), + or if the program runs out of stack space while matching the expression (if Boost.regex is configured in recursive mode), or if the matcher exhausts it's permitted memory allocation (if Boost.regex is configured in non-recursive mode).

    @@ -231,20 +237,20 @@ bool regex_match(BidirectionalIterator first, BidirectionalIterator last,

     
    -
    template <class BidirectionalIterator, class charT, class traits, class Allocator2>
    +      
    template <class BidirectionalIterator, class charT, class traits, class Allocator2>
     bool regex_match(BidirectionalIterator first, BidirectionalIterator last,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);

    Effects: Behaves "as if" by constructing an instance of match_results<BidirectionalIterator> what, and then returning the result of regex_match(first, last, what, e, flags).

    -
    template <class charT, class Allocator, class traits, class Allocator2>
    +      
    template <class charT, class Allocator, class traits, class Allocator2>
     bool regex_match(const charT* str, match_results<const charT*, Allocator>& m,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);

    Effects: Returns the result of regex_match(str, str + char_traits<charT>::length(str), m, e, flags).

    -
    template <class ST, class SA, class Allocator, class charT,
    +      
    template <class ST, class SA, class Allocator, class charT,
               class traits, class Allocator2>
     bool regex_match(const basic_string<charT, ST, SA>& s,
                      match_results<typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m, 
    @@ -252,13 +258,13 @@ bool regex_match(const basic_string<charT, ST, SA>& s,
                      match_flag_type flags = match_default);

    Effects: Returns the result of regex_match(s.begin(), s.end(), m, e, flags).

    -
    template <class charT, class traits, class Allocator2>
    +      
    template <class charT, class traits, class Allocator2>
     bool regex_match(const charT* str,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);

    Effects: Returns the result of regex_match(str, str + char_traits<charT>::length(str), e, flags).

    -
    template <class ST, class SA, class charT, class traits, class Allocator2>
    +      
    template <class ST, class SA, class charT, class traits, class Allocator2>
     bool regex_match(const basic_string<charT, ST, SA>& s,
                      const basic_regex<charT, traits, Allocator2>& e,
                      match_flag_type flags = match_default);
    diff --git a/doc/regex_replace.html b/doc/regex_replace.html index 8ff9764d..0fe074a8 100644 --- a/doc/regex_replace.html +++ b/doc/regex_replace.html @@ -29,7 +29,7 @@

    Synopsis

    #include <boost/regex.hpp> 

    The algorithm regex_replace searches through a string finding - all the matches to the regular expression: for each match it then calls + all the matches to the regular expression: for each match it then calls match_results::format to format the string and sends the result to the output iterator. Sections of text that do not match are copied to the output unchanged only if the flags parameter does not have the flag @@ -37,39 +37,87 @@ is set then only the first occurrence is replaced rather than all occurrences. 

    template <class OutputIterator, class BidirectionalIterator, class traits,
               class Allocator, class charT>
    -OutputIterator regex_replace(OutputIterator out,
    +OutputIterator regex_replace(OutputIterator out,
                                BidirectionalIterator first,
                                BidirectionalIterator last,
    -                           const basic_regex<charT, traits, Allocator>& e,
    +                           const basic_regex<charT, traits, Allocator>& e,
                                const basic_string<charT>& fmt,
    -                           match_flag_type flags = match_default);
    +                           match_flag_type flags = match_default);
     
     template <class traits, class Allocator, class charT>
    -basic_string<charT> regex_replace(const basic_string<charT>& s,
    -                            const basic_regex<charT, traits, Allocator>& e,
    +basic_string<charT> regex_replace(const basic_string<charT>& s,
    +                            const basic_regex<charT, traits, Allocator>& e,
                                 const basic_string<charT>& fmt,
    -                            match_flag_type flags = match_default);
    +                            match_flag_type flags = match_default);
     
     

    Description

    -
    template <class OutputIterator, class BidirectionalIterator, class traits,
    +         
    template <class OutputIterator, class BidirectionalIterator, class traits,
               class Allocator, class charT>
     OutputIterator regex_replace(OutputIterator out,
                                BidirectionalIterator first,
                                BidirectionalIterator last,
    -                           const basic_regex<charT, traits, Allocator>& e,
    +                           const basic_regex<charT, traits, Allocator>& e,
                                const basic_string<charT>& fmt,
    -                           match_flag_type flags = match_default);
    -

    Effects: Finds all the non-overlapping matches m of type match_results<BidirectionalIterator> - that occur within the sequence [first, last). If no such matches are - found and !(flags & format_no_copy) then calls std::copy(first, - last, out). Otherwise, for each match found, if !(flags & - format_no_copy) calls std::copy(m.prefix().first, m.prefix().last, - out), and then calls m.format(out, fmt, flags). Finally - if !(flags & format_no_copy) calls std::copy(last_m.suffix().first, - last_m,suffix().last, out) where last_m is a copy of the - last match found. If flags & format_first_only is non-zero - then only the first match found is replaced.

    + match_flag_type flags = match_default);
    +

    Enumerates all the occurences of expression e in the sequence [first, + last), replacing each occurence with the string that results by merging the + match found with the format string fmt, and copies the resulting + string to out

    +

    If the flag format_no_copy is set in flags then unmatched sections of + text are not copied to output.  +

    +

    If the flag format_first_only is set in flags then only the first + occurence of e is replaced.  +

    +

    The manner in which the format string fmt is interpretted, along with + the rules used for finding matches, are determined by the + flags set in flags

    +

    Effects: Constructs an + regex_iterator + object: +

    +
    regex_iterator<BidirectionalIterator, charT, traits, Allocator> 
    i(first, last, e, flags),
    +

    and uses + + i + to enumerate through all of the matches m of type + + match_results + <BidirectionalIterator> that + occur within the sequence [first, last). +

    +

    If no such matches are found + and

    +
    !(flags & format_no_copy) 
    +

    then calls +

    +
    std::copy(first, last, out). 
    +

    Otherwise, for each match found, + if

    +
    !(flags & format_no_copy) 
    +

    calls +

    +
    std::copy(m.prefix().first, m.prefix().last, out), 
    +

    and then calls +

    +
    m.format(out, fmt, flags). 
    +

    Finally + if

    +
    !(flags & format_no_copy) 
    +

    calls +

    +
    std::copy(last_m.suffix().first, last_m,suffix().last, out) 
    +

    where + + last_m + + is a copy of the last match found. +

    +

    If + flags & +format_first_only + is non-zero then only the first match found is replaced.

    Throws: std::runtime_error if the complexity of matching the expression against an N character string begins to exceed O(N2), or if the program runs out of stack space while matching the expression (if @@ -78,11 +126,11 @@ OutputIterator regex_replace(OutputIterator out, configured in non-recursive mode).

    Returns: out.

    -
    template <class traits, class Allocator, class charT>
    +      
    template <class traits, class Allocator, class charT>
     basic_string<charT> regex_replace(const basic_string<charT>& s,
    -                            const basic_regex<charT, traits, Allocator>& e,
    +                            const basic_regex<charT, traits, Allocator>& e,
                                 const basic_string<charT>& fmt,
    -                            match_flag_type flags = match_default);
    + match_flag_type flags = match_default);

    Effects: Constructs an object basic_string<charT> result, calls regex_replace(back_inserter(result), s.begin(), s.end(), e, fmt, flags), and then returns result. diff --git a/doc/regex_search.html b/doc/regex_search.html index 97850ba7..f7017fea 100644 --- a/doc/regex_search.html +++ b/doc/regex_search.html @@ -37,7 +37,7 @@

    template <class BidirectionalIterator, 
               class Allocator, class charT,
               class traits, class Allocator2>
    -bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
    +bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
                       match_results<BidirectionalIterator, Allocator>& m,
                       const basic_regex<charT, traits, Allocator2>& e,
                       match_flag_type flags = match_default);
    @@ -45,7 +45,7 @@ bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
     template <class ST, class SA, 
               class Allocator, class charT,
               class traits, class Allocator2> 
    -bool regex_search(const basic_string<charT, ST, SA>& s, 
    +bool regex_search(const basic_string<charT, ST, SA>& s, 
                       match_results<
                           typename basic_string<charT, ST,SA>::const_iterator, 
                           Allocator>& m, 
    @@ -54,32 +54,32 @@ bool regex_search(const basic_string<charT, ST, SA>& s,
               
     template<class charT, class Allocator, class traits, 
              class Allocator2> 
    -bool regex_search(const charT* str, 
    +bool regex_search(const charT* str, 
                       match_results<const charT*, Allocator>& m, 
                       const basic_regex<charT, traits, Allocator2>& e,
                       match_flag_type flags = match_default);
                       
     template <class BidirectionalIterator, class Allocator,
               class charT, class traits>                
    -bool regex_search(BidirectionalIterator first, BidirectionalIterator last, 
    +bool regex_search(BidirectionalIterator first, BidirectionalIterator last, 
                       const basic_regex<charT, traits, Allocator>& e, 
                       match_flag_type flags = match_default); 
                       
     template <class charT, class Allocator, 
               class traits> 
    -bool regex_search(const charT* str, 
    +bool regex_search(const charT* str, 
                       const basic_regex<charT, traits, Allocator>& e, 
                       match_flag_type flags = match_default); 
                       
     template<class ST, class SA,
              class Allocator, class charT, 
              class traits>
    -bool regex_search(const basic_string<charT, ST, SA>& s,
    +bool regex_search(const basic_string<charT, ST, SA>& s,
                       const basic_regex<charT, traits, Allocator>& e,
                       match_flag_type flags = match_default);
     

    Description

    -
    template <class BidirectionalIterator, class Allocator, class charT,
    +         
    template <class BidirectionalIterator, class Allocator, class charT,
               class traits, class Allocator2>
     bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
                       match_results<BidirectionalIterator, Allocator>& m,
    @@ -234,13 +234,13 @@ bool regex_search(BidirectionalIterator first, BidirectionalIterator last,
                    
              
           
    -      
    template <class charT, class Allocator, class traits, class Allocator2>
    +      
    template <class charT, class Allocator, class traits, class Allocator2>
     bool regex_search(const charT* str, match_results<const charT*, Allocator>& m,
                       const basic_regex<charT, traits, Allocator2>& e,
                       match_flag_type flags = match_default);

    Effects: Returns the result of regex_search(str, str + char_traits<charT>::length(str), m, e, flags).

    -
    template <class ST, class SA, class Allocator, class charT,
    +      
    template <class ST, class SA, class Allocator, class charT,
               class traits, class Allocator2>
     bool regex_search(const basic_string<charT, ST, SA>& s,
                       match_results<typename basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
    @@ -248,7 +248,7 @@ bool regex_search(const basic_string<charT, ST, SA>& s,
                       match_flag_type flags = match_default);

    Effects: Returns the result of regex_search(s.begin(), s.end(), m, e, flags).

    -
    template <class iterator, class Allocator, class charT,
    +      
    template <class iterator, class Allocator, class charT,
               class traits>
     bool regex_search(iterator first, iterator last,
                       const basic_regex<charT, traits, Allocator>& e,
    @@ -256,13 +256,13 @@ bool regex_search(iterator first, iterator last,
           

    Effects: Behaves "as if" by constructing an instance of match_results<BidirectionalIterator> what, and then returning the result of regex_search(first, last, what, e, flags).

    -
    template <class charT, class Allocator, class traits>
    +      
    template <class charT, class Allocator, class traits>
     bool regex_search(const charT* str
                       const basic_regex<charT, traits, Allocator>& e,
                       match_flag_type flags = match_default);

    Effects: Returns the result of regex_search(str, str + char_traits<charT>::length(str), e, flags).

    -
    template <class ST, class SA, class Allocator, class charT,
    +      
    template <class ST, class SA, class Allocator, class charT,
               class traits>
     bool regex_search(const basic_string<charT, ST, SA>& s,
                       const basic_regex<charT, traits, Allocator>& e,
    diff --git a/doc/regex_token_iterator.html b/doc/regex_token_iterator.html
    index 03e2e64e..838dcf28 100644
    --- a/doc/regex_token_iterator.html
    +++ b/doc/regex_token_iterator.html
    @@ -45,35 +45,35 @@ template <class BidirectionalIterator,
     class regex_token_iterator 
     {
     public:
    -   typedef          basic_regex<charT, traits, Allocator>                   regex_type;
    +   typedef          basic_regex<charT, traits, Allocator>                   regex_type;
        typedef          basic_string<charT>                                     value_type;
        typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type;
        typedef          const value_type*                                       pointer;
        typedef          const value_type&                                       reference;
        typedef          std::forward_iterator_tag                               iterator_category;
        
    -   regex_token_iterator();
    -   regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
    -                        int submatch = 0, match_flag_type m = match_default);
    -   regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
    +   regex_token_iterator();
    +   regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
    +                        int submatch = 0, match_flag_type m = match_default);
    +   regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
                             const std::vector<int>& submatches, match_flag_type m = match_default);
        template <std::size_t N>
    -   regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
    +   regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
                             const int (&submatches)[N], match_flag_type m = match_default);
    -   regex_token_iterator(const regex_token_iterator&);
    -   regex_token_iterator& operator=(const regex_token_iterator&);
    -   bool operator==(const regex_token_iterator&);
    -   bool operator!=(const regex_token_iterator&);
    -   const value_type& operator*();
    -   const value_type* operator->();
    -   regex_token_iterator& operator++();
    -   regex_token_iterator operator++(int);
    +   regex_token_iterator(const regex_token_iterator&);
    +   regex_token_iterator& operator=(const regex_token_iterator&);
    +   bool operator==(const regex_token_iterator&)const;
    +   bool operator!=(const regex_token_iterator&)const;
    +   const value_type& operator*()const;
    +   const value_type* operator->()const;
    +   regex_token_iterator& operator++();
    +   regex_token_iterator operator++(int);
     };
     

    Description

    -
    regex_token_iterator();
    +
    regex_token_iterator();

    Effects: constructs an end of sequence iterator.

    -
    regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
    +      
    regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
                          int submatch = 0, match_flag_type m = match_default);

    Preconditions: !re.empty().

    Effects: constructs a regex_token_iterator that will enumerate one @@ -88,7 +88,7 @@ public: Boost.regex is configured in recursive mode), or if the matcher exhausts it's permitted memory allocation (if Boost.regex is configured in non-recursive mode).

    -
    regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
    +      
    regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
                          const std::vector<int>& submatches, match_flag_type m = match_default);

    Preconditions: submatches.size() && !re.empty().

    Effects: constructs a regex_token_iterator that will enumerate submatches.size() @@ -106,7 +106,7 @@ public: Boost.regex is configured in recursive mode), or if the matcher exhausts it's permitted memory allocation (if Boost.regex is configured in non-recursive mode).

    -
    template <std::size_t N>
    +      
    template <std::size_t N>
     regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, 
                          const int (&submatches)[R], match_flag_type m = match_default);

    Preconditions: !re.empty().

    @@ -126,25 +126,25 @@ regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const reg Boost.regex is configured in recursive mode), or if the matcher exhausts it's permitted memory allocation (if Boost.regex is configured in non-recursive mode).

    -
    regex_token_iterator(const regex_token_iterator& that);
    +
    regex_token_iterator(const regex_token_iterator& that);

    Effects: constructs a copy of that.

    Postconditions: *this == that.

    -
    regex_token_iterator& operator=(const regex_token_iterator& that);
    +
    regex_token_iterator& operator=(const regex_token_iterator& that);

    Effects: sets *this to be equal to that.

    Postconditions: *this == that.

    -
    bool operator==(const regex_token_iterator&);
    +
    bool operator==(const regex_token_iterator&)const;

    Effects: returns true if *this is the same position as that.

    -
    bool operator!=(const regex_token_iterator&);
    +
    bool operator!=(const regex_token_iterator&)const;

    Effects: returns !(*this == that).

    -
    const value_type& operator*();
    +
    const value_type& operator*()const;

    Effects: returns the current string being enumerated.

    -
    const value_type* operator->();
    +
    const value_type* operator->()const;

    Effects: returns &(*this).

    -
    regex_token_iterator& operator++();
    +
    regex_token_iterator& operator++();

    Effects: Moves on to the next string to be enumerated.

    Throws: std::runtime_error if the complexity of @@ -155,7 +155,7 @@ regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const reg configured in non-recursive mode).

    - Returns: *this.

    regex_token_iterator& operator++(int);
    + Returns: *this.

    regex_token_iterator& operator++(int);

    Effects: constructs a copy result of *this, then calls ++(*this).

    Returns: result. diff --git a/doc/sub_match.html b/doc/sub_match.html index 19b12c8d..fc966dd9 100644 --- a/doc/sub_match.html +++ b/doc/sub_match.html @@ -38,6 +38,9 @@

    Objects of type sub_match may only obtained by subscripting an object of type match_results . +

    Objects of type sub_match may be compared to objects of type std::basic_string, + or const charT* or const charT + .

    When the marked sub-expression denoted by an object of type sub_match<> participated in a regular expression match then member matched evaluates to true, and members first and second denote the @@ -61,154 +64,197 @@ public: typedef typename iterator_traits<BidirectionalIterator>::difference_type difference_type; typedef BidirectionalIterator iterator; - bool matched; + bool matched; - difference_type length()const; - operator basic_string<value_type>()const; - basic_string<value_type> str()const; + difference_type length()const; + operator basic_string<value_type>()const; + basic_string<value_type> str()const; - int compare(const sub_match& s)const; - int compare(const basic_string<value_type>& s)const; - int compare(const value_type* s)const; + int compare(const sub_match& s)const; + int compare(const basic_string<value_type>& s)const; + int compare(const value_type* s)const; }; - +// +// comparisons to another sub_match: +// template <class BidirectionalIterator> -bool operator == (const sub_match<BidirectionalIterator>& lhs, +bool operator == (const sub_match<BidirectionalIterator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator != (const sub_match<BidirectionalIterator>& lhs, +bool operator != (const sub_match<BidirectionalIterator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator < (const sub_match<BidirectionalIterator>& lhs, +bool operator < (const sub_match<BidirectionalIterator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator <= (const sub_match<BidirectionalIterator>& lhs, +bool operator <= (const sub_match<BidirectionalIterator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator >= (const sub_match<BidirectionalIterator>& lhs, +bool operator >= (const sub_match<BidirectionalIterator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator > (const sub_match<BidirectionalIterator>& lhs, +bool operator > (const sub_match<BidirectionalIterator>& lhs, const sub_match<BidirectionalIterator>& rhs); +// +// comparisons to a basic_string: +// template <class BidirectionalIterator, class traits, class Allocator> -bool operator == (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, +bool operator == (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator != (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, +bool operator != (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator < (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, +bool operator < (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator > (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, +bool operator > (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator >= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, +bool operator >= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator <= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, +bool operator <= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator == (const sub_match<BidirectionalIterator>& lhs, +bool operator == (const sub_match<BidirectionalIterator>& lhs, const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator != (const sub_match<BidirectionalIterator>& lhs, +bool operator != (const sub_match<BidirectionalIterator>& lhs, const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator < (const sub_match<BidirectionalIterator>& lhs, +bool operator < (const sub_match<BidirectionalIterator>& lhs, const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator > (const sub_match<BidirectionalIterator>& lhs, +bool operator > (const sub_match<BidirectionalIterator>& lhs, const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator >= (const sub_match<BidirectionalIterator>& lhs, +bool operator >= (const sub_match<BidirectionalIterator>& lhs, const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs); template <class BidirectionalIterator, class traits, class Allocator> -bool operator <= (const sub_match<BidirectionalIterator>& lhs, +bool operator <= (const sub_match<BidirectionalIterator>& lhs, const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs); +// +// comparisons to a pointer to a character array: +// template <class BidirectionalIterator> -bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, +bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, +bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, +bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, +bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, +bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, +bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator == (const sub_match<BidirectionalIterator>& lhs, +bool operator == (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const* rhs); template <class BidirectionalIterator> -bool operator != (const sub_match<BidirectionalIterator>& lhs, +bool operator != (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const* rhs); template <class BidirectionalIterator> -bool operator < (const sub_match<BidirectionalIterator>& lhs, +bool operator < (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const* rhs); template <class BidirectionalIterator> -bool operator > (const sub_match<BidirectionalIterator>& lhs, +bool operator > (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const* rhs); template <class BidirectionalIterator> -bool operator >= (const sub_match<BidirectionalIterator>& lhs, +bool operator >= (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const* rhs); template <class BidirectionalIterator> -bool operator <= (const sub_match<BidirectionalIterator>& lhs, +bool operator <= (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const* rhs); +// +// comparisons to a single character: +// template <class BidirectionalIterator> -bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, +bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, +bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, +bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, +bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, +bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, +bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, const sub_match<BidirectionalIterator>& rhs); template <class BidirectionalIterator> -bool operator == (const sub_match<BidirectionalIterator>& lhs, +bool operator == (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const& rhs); template <class BidirectionalIterator> -bool operator != (const sub_match<BidirectionalIterator>& lhs, +bool operator != (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const& rhs); template <class BidirectionalIterator> -bool operator < (const sub_match<BidirectionalIterator>& lhs, +bool operator < (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const& rhs); template <class BidirectionalIterator> -bool operator > (const sub_match<BidirectionalIterator>& lhs, +bool operator > (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const& rhs); template <class BidirectionalIterator> -bool operator >= (const sub_match<BidirectionalIterator>& lhs, +bool operator >= (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const& rhs); template <class BidirectionalIterator> -bool operator <= (const sub_match<BidirectionalIterator>& lhs, +bool operator <= (const sub_match<BidirectionalIterator>& lhs, typename iterator_traits<BidirectionalIterator>::value_type const& rhs); +// +// addition operators: +// +template <class RandomAccessIterator, class traits, class Allocator> +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator> + operator + (const std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s, + const sub_match<RandomAccessIterator>& m); +template <class RandomAccessIterator, class traits, class Allocator> +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator> + operator + (const sub_match<RandomAccessIterator>& m, + const std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s); +template <class RandomAccessIterator> std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> + operator + (typename iterator_traits<RandomAccessIterator>::value_type const* s, + const sub_match<RandomAccessIterator>& m); +template <class RandomAccessIterator> std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> + operator + (const sub_match<RandomAccessIterator>& m, + typename iterator_traits<RandomAccessIterator>::value_type const * s); +template <class RandomAccessIterator> +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> + operator + (typename iterator_traits<RandomAccessIterator>::value_type const& s, + const sub_match<RandomAccessIterator>& m); +template <class RandomAccessIterator> +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> + operator + (const sub_match<RandomAccessIterator>& m, + typename iterator_traits<RandomAccessIterator>::value_type const& s); +template <class RandomAccessIterator> +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> + operator + (const sub_match<RandomAccessIterator>& m1, + const sub_match<RandomAccessIterator>& m2); +// +// stream inserter: +// template <class charT, class traits, class BidirectionalIterator> basic_ostream<charT, traits>& - operator << (basic_ostream<charT, traits>& os, + operator << (basic_ostream<charT, traits>& os, const sub_match<BidirectionalIterator>& m); } // namespace boost

    @@ -225,188 +271,278 @@ basic_ostream<charT, traits>&

    An iterator denoting the position of the start of the match.

    iterator second

    An iterator denoting the position of the end of the match.

    -
    bool matched
    +
    bool matched

    A Boolean value denoting whether this sub-expression participated in the match.

    -
    static difference_type length();
    - -

    - Effects: returns (matched ? 0 : distance(first, second)).

    operator basic_string<value_type>()const;
    - -

    - Effects: returns (matched ? basic_string<value_type>(first, - second) : basic_string<value_type>()).

    basic_string<value_type> str()const;
    - -

    - Effects: returns (matched ? basic_string<value_type>(first, - second) : basic_string<value_type>()).

    int compare(const sub_match& s)const;
    - -

    - Effects: returns str().compare(s.str()).

    int compare(const basic_string<value_type>& s)const;
    - -

    - Effects: returns str().compare(s).

    int compare(const value_type* s)const;
    - -

    - Effects: returns str().compare(s).

    +
    static difference_type length();
    +

    + Effects: returns the length of this matched sub-expression, or 0 if this + sub-expression was not matched: matched ? distance(first, second) : 0).

    +
    operator basic_string<value_type>()const;
    +

    + Effects: converts *this into a string: returns (matched ? + basic_string<value_type>(first, second) : + basic_string<value_type>()).

    +
    basic_string<value_type> str()const;
    +

    Effects: returns a string representation of *this:  (matched ? + basic_string<value_type>(first, second) : + basic_string<value_type>()).

    +
    int compare(const sub_match& s)const;
    +

    + Effects: performs a lexical comparison to s: returns str().compare(s.str()).

    +
    int compare(const basic_string<value_type>& s)const;
    +

    Effects: compares *this to the string s: returns str().compare(s).

    +
    int compare(const value_type* s)const;
    +

    + Effects: compares *this to the null-terminated string s: returns + str().compare(s).

    sub_match non-member operators

    -
    template <class BidirectionalIterator>
    +      
    Comparisons against self
    +
    template <class BidirectionalIterator>
     bool operator == (const sub_match<BidirectionalIterator>& lhs,
                       const sub_match<BidirectionalIterator>& rhs);
    - -

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

    template <class BidirectionalIterator>
    +      

    + Effects: returns lhs.compare(rhs) == 0.

    +
    template <class BidirectionalIterator>
     bool operator != (const sub_match<BidirectionalIterator>& lhs,
                       const sub_match<BidirectionalIterator>& rhs);
    - -

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

    template <class BidirectionalIterator>
    +      

    + Effects: returns lhs.compare(rhs) != 0.

    +
    template <class BidirectionalIterator>
     bool operator < (const sub_match<BidirectionalIterator>& lhs,
                      const sub_match<BidirectionalIterator>& rhs);
    - -

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

    template <class BidirectionalIterator>
    +      

    + Effects: returns lhs.compare(rhs) < 0.

    +
    template <class BidirectionalIterator>
     bool operator <= (const sub_match<BidirectionalIterator>& lhs,
                       const sub_match<BidirectionalIterator>& rhs);
    - -

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

    template <class BidirectionalIterator>
    +      

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

    +
    template <class BidirectionalIterator>
     bool operator >= (const sub_match<BidirectionalIterator>& lhs,
                       const sub_match<BidirectionalIterator>& rhs);
    - -

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

    template <class BidirectionalIterator>
    +      

    + Effects: returns lhs.compare(rhs) >= 0.

    +
    template <class BidirectionalIterator>
     bool operator > (const sub_match<BidirectionalIterator>& lhs,
                      const sub_match<BidirectionalIterator>& rhs);
    - -

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

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.compare(rhs) > 0.

    +
    Comparisons with std::basic_string
    +
    
    +template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator == (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits,
    +                  Allocator>& lhs, const sub_match<BidirectionalIterator>& rhs);
    +
    +

    Effects: returns lhs == rhs.str().

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator != (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
    +                  const sub_match<BidirectionalIterator>& rhs);
    +

    Effects: returns lhs != rhs.str().

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator < (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
    +                 const sub_match<BidirectionalIterator>& rhs);
    +

    Effects: returns lhs < rhs.str().

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator > (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
    +                 const sub_match<BidirectionalIterator>& rhs);
    +

    Effects: returns lhs > rhs.str().

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator >= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
    +                  const sub_match<BidirectionalIterator>& rhs);
    +

    Effects: returns lhs >= rhs.str().

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator <= (const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& lhs,
    +                  const sub_match<BidirectionalIterator>& rhs);
    +

    Effects: returns lhs <= rhs.str().

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator == (const sub_match<BidirectionalIterator>& lhs,
    +                  const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
    +

    Effects: returns lhs.str() == rhs.

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator != (const sub_match<BidirectionalIterator>& lhs,
    +                  const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
    +

    Effects: returns lhs.str() != rhs.

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator < (const sub_match<BidirectionalIterator>& lhs,
    +                 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
    +

    Effects: returns lhs.str() < rhs.

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator > (const sub_match<BidirectionalIterator>& lhs,
    +                 const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
    +

    Effects: returns lhs.str() > rhs.

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator >= (const sub_match<BidirectionalIterator>& lhs,
    +                  const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
    +

    Effects: returns lhs.str() >= rhs.

    +
    template <class BidirectionalIterator, class traits, class Allocator> 
    +bool operator <= (const sub_match<BidirectionalIterator>& lhs,
    +                  const std::basic_string<iterator_traits<BidirectionalIterator>::value_type, traits, Allocator>& rhs);
    +

    Effects: returns lhs.str() <= rhs.

    +
    Comparisons with null-terminated strings
    +
    template <class BidirectionalIterator> 
     bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 
                       const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs == rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs == rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 
                       const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs != rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs != rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 
                      const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs < rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs < rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 
                      const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs > rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs > rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 
                       const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs >= rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs >= rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const* lhs, 
                       const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs <= rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs <= rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator == (const sub_match<BidirectionalIterator>& lhs, 
                       typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 
    - -

    - Effects: returns lhs.str() == rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() == rhs.

    +
    template <class BidirectionalIterator> 
     bool operator != (const sub_match<BidirectionalIterator>& lhs, 
                       typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 
    - -

    - Effects: returns lhs.str() != rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() != rhs.

    +
    template <class BidirectionalIterator> 
     bool operator < (const sub_match<BidirectionalIterator>& lhs, 
                      typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 
    - -

    - Effects: returns lhs.str() < rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() < rhs.

    +
    template <class BidirectionalIterator> 
     bool operator > (const sub_match<BidirectionalIterator>& lhs, 
                      typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 
    - -

    - Effects: returns lhs.str() > rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() > rhs.

    +
    template <class BidirectionalIterator> 
     bool operator >= (const sub_match<BidirectionalIterator>& lhs, 
                       typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 
    - -

    - Effects: returns lhs.str() >= rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() >= rhs.

    +
    template <class BidirectionalIterator> 
     bool operator <= (const sub_match<BidirectionalIterator>& lhs, 
                       typename iterator_traits<BidirectionalIterator>::value_type const* rhs); 
    - -

    - Effects: returns lhs.str() <= rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() <= rhs.

    +
    Comparisons with a single character
    +
    template <class BidirectionalIterator> 
     bool operator == (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 
                       const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs == rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs == rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator != (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 
                       const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs != rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs != rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator < (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 
                      const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs < rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs < rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator > (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 
                      const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs > rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs > rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator >= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 
                       const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs >= rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs >= rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator <= (typename iterator_traits<BidirectionalIterator>::value_type const& lhs, 
                       const sub_match<BidirectionalIterator>& rhs); 
    - -

    - Effects: returns lhs <= rhs.str().

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs <= rhs.str().

    +
    template <class BidirectionalIterator> 
     bool operator == (const sub_match<BidirectionalIterator>& lhs, 
                       typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 
    - -

    - Effects: returns lhs.str() == rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() == rhs.

    +
    template <class BidirectionalIterator> 
     bool operator != (const sub_match<BidirectionalIterator>& lhs, 
                       typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 
    - -

    - Effects: returns lhs.str() != rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() != rhs.

    +
    template <class BidirectionalIterator> 
     bool operator < (const sub_match<BidirectionalIterator>& lhs, 
                      typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 
    - -

    - Effects: returns lhs.str() < rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() < rhs.

    +
    template <class BidirectionalIterator> 
     bool operator > (const sub_match<BidirectionalIterator>& lhs, 
                      typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 
    - -

    - Effects: returns lhs.str() > rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() > rhs.

    +
    template <class BidirectionalIterator> 
     bool operator >= (const sub_match<BidirectionalIterator>& lhs, 
                       typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 
    - -

    - Effects: returns lhs.str() >= rhs.

    template <class BidirectionalIterator> 
    +      

    + Effects: returns lhs.str() >= rhs.

    +
    template <class BidirectionalIterator> 
     bool operator <= (const sub_match<BidirectionalIterator>& lhs, 
                       typename iterator_traits<BidirectionalIterator>::value_type const& rhs); 
    - -

    - Effects: returns lhs.str() <= rhs.

    template <class charT, class traits, class BidirectionalIterator>
    +      

    + Effects: returns lhs.str() <= rhs.

    +
    Addition operators
    +

    The addition operators for sub_match allow you to add a sub_match to any type + to which you can add a std::string and obtain a new string as the result.

    +
    template <class RandomAccessIterator, class traits, class Allocator> 
    +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator> 
    +    operator + (const std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s, 
    +                const sub_match<RandomAccessIterator>& m); 
    +

    Effects: returns s + m.str().

    +
    template <class RandomAccessIterator, class traits, class Allocator> 
    +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>
    +    operator + (const sub_match<RandomAccessIterator>& m, 
    +                const std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s); 
    +

    Effects: returns m.str() + s.

    +
    template <class RandomAccessIterator> std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> 
    +    operator + (typename iterator_traits<RandomAccessIterator>::value_type const* s, 
    +                const sub_match<RandomAccessIterator>& m); 
    +

    Effects: returns s + m.str().

    +
    template <class RandomAccessIterator> std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> 
    +    operator + (const sub_match<RandomAccessIterator>& m, 
    +                typename iterator_traits<RandomAccessIterator>::value_type const * s);
    +

    Effects: returns m.str() + s.

    +
    template <class RandomAccessIterator> 
    +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> 
    +    operator + (typename iterator_traits<RandomAccessIterator>::value_type const& s, 
    +                const sub_match<RandomAccessIterator>& m); 
    +

    Effects: returns s + m.str().

    +
    template <class RandomAccessIterator> 
    +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> 
    +    operator + (const sub_match<RandomAccessIterator>& m, 
    +                typename iterator_traits<RandomAccessIterator>::value_type const& s); 
    +

    Effects: returns m.str() + s.

    +
    template <class RandomAccessIterator> 
    +std::basic_string<typename iterator_traits<RandomAccessIterator>::value_type> 
    +    operator + (const sub_match<RandomAccessIterator>& m1,
    +                const sub_match<RandomAccessIterator>& m2);
    +

    Effects: returns m1.str() + m2.str().

    +
    Stream inserter
    +
    template <class charT, class traits, class BidirectionalIterator>
     basic_ostream<charT, traits>&
        operator << (basic_ostream<charT, traits>& os
                     const sub_match<BidirectionalIterator>& m);
    - -

    - Effects: returns (os << m.str()). +

    + Effects: returns (os << m.str()).


    Revised @@ -422,5 +558,3 @@ basic_ostream<charT, traits>& for any purpose. It is provided "as is" without express or implied warranty.

    - - diff --git a/doc/thread_safety.html b/doc/thread_safety.html index eeda681d..20cee284 100644 --- a/doc/thread_safety.html +++ b/doc/thread_safety.html @@ -23,6 +23,11 @@


    +

    The regex library is thread safe when Boost is: you can verify that Boost is in + thread safe mode by checking to see if BOOST_HAS_THREADS is defined: this macro + is set automatically by the config system when threading support is turned on + in your compiler. +

    Class basic_regex<> and its typedefs regex and wregex are thread safe, in that compiled regular expressions can safely be shared between threads. The matching algorithms regex_match, @@ -65,4 +70,3 @@ for any purpose. It is provided "as is" without express or implied warranty.

    -