A regex iterator helps to iterate over matched subsequences. However, sometimes you also want to process all the contents between matched expressions. That is especially the case if you want to split a string into separate tokens, separated by something, which might even be specified as a regular expression. Class regex_token_iterator having the usual instantiations for strings and character sequences with prefixes s, c, ws, or wc provides this functionality.
Again, to initialize it, you can pass the beginning and end of a character sequence and a regular expression. In addition, you can specify a list of integral values, which represent elements of a “tokenization”:
• -1 means that you are interested in all the subsequences between matched regular expressions
(token separators).
• 0 means that you are interested in all the matched regular expressions (token separators).
• Any other value n means that you are interested in the matched nth subexpression inside the
regular expressions.
Now consider the following example:
A regex iterator helps to iterate over matched subsequences. However, sometimes you also want to process all the contents between matched expressions. That is especially the case if you want to split a string into separate tokens, separated by something, which might even be specified as a regular expression. Class regex_token_iterator<> having the usual instantiations for strings and character sequences with prefixes s, c, ws, or wc provides this functionality.
Again, to initialize it, you can pass the beginning and end of a character sequence and a regular expression. In addition, you can specify a list of integral values, which represent elements of a “tokenization”:
• -1 means that you are interested in all the subsequences between matched regular expressions
(token separators).
• 0 means that you are interested in all the matched regular expressions (token separators).
• Any other value n means that you are interested in the matched nth subexpression inside the
regular expressions.
Now consider the following example:
การแปล กรุณารอสักครู่..
![](//thimg.ilovetranslation.com/pic/loading_3.gif?v=b9814dd30c1d7c59_8619)