Type u32regex_iterator
is in all respects the same as regex_iterator except that since
the regular expression type is always u32regex
it only takes one template parameter (the iterator type). It also calls
u32regex_search internally,
allowing it to interface correctly with UTF-8, UTF-16, and UTF-32 data:

template<classBidirectionalIterator>classu32regex_iterator{// for members see regex_iterator};typedefu32regex_iterator<constchar*>utf8regex_iterator;typedefu32regex_iterator<constUChar*>utf16regex_iterator;typedefu32regex_iterator<constUChar32*>utf32regex_iterator;

In order to simplify the construction of a u32regex_iterator
from a string, there are a series of non-member helper functions called
make_u32regex_iterator:

Each of these overloads returns an iterator that enumerates all occurrences
of expression e, in text s,
using match_flags m.

Example: search for international currency symbols, along with their
associated numeric value:

voidenumerate_currencies(conststd::string&text){// enumerate and print all the currency symbols, along// with any associated numeric values:constchar*re="([[:Sc:]][[:Cf:][:Cc:][:Z*:]]*)?""([[:Nd:]]+(?:[[:Po:]][[:Nd:]]+)?)?""(?(1)""|(?(2)""[[:Cf:][:Cc:][:Z*:]]*"")""[[:Sc:]]"")";boost::u32regexr=boost::make_u32regex(re);boost::u32regex_iterator<std::string::const_iterator>i(boost::make_u32regex_iterator(text,r)),j;while(i!=j){std::cout<<(*i)[0]<<std::endl;++i;}}

Type u32regex_token_iterator
is in all respects the same as regex_token_iterator except
that since the regular expression type is always u32regex
it only takes one template parameter (the iterator type). It also calls
u32regex_search internally,
allowing it to interface correctly with UTF-8, UTF-16, and UTF-32 data:

template<classBidirectionalIterator>classu32regex_token_iterator{// for members see regex_token_iterator};typedefu32regex_token_iterator<constchar*>utf8regex_token_iterator;typedefu32regex_token_iterator<constUChar*>utf16regex_token_iterator;typedefu32regex_token_iterator<constUChar32*>utf32regex_token_iterator;

In order to simplify the construction of a u32regex_token_iterator
from a string, there are a series of non-member helper functions called
make_u32regex_token_iterator:

Each of these overloads returns an iterator that enumerates one sub-expression
for each submatch in regular expression e, found
in text s, using match_flags m.

Example: search for international currency symbols, along with their
associated numeric value:

voidenumerate_currencies2(conststd::string&text){// enumerate and print all the currency symbols, along// with any associated numeric values:constchar*re="([[:Sc:]][[:Cf:][:Cc:][:Z*:]]*)?""([[:Nd:]]+(?:[[:Po:]][[:Nd:]]+)?)?""(?(1)""|(?(2)""[[:Cf:][:Cc:][:Z*:]]*"")""[[:Sc:]]"")";boost::u32regexr=boost::make_u32regex(re);boost::u32regex_token_iterator<std::string::const_iterator>i(boost::make_u32regex_token_iterator(text,r,1)),j;while(i!=j){std::cout<<*i<<std::endl;++i;}}