std::match_results::position
Материал из cppreference.com
< cpp | regex | match results
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| difference_type position( size_type sub = 0 ) const; |
(начиная с C++11) | |
Возвращает позицию первого символа указанного суб-матч.
Original:
Returns the position of the first character of the specified sub-match.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Если n == 0, позиция первого символа всего соответствует выражению возвращается.
Original:
If n == 0, the position of the first character of entire matched expression is returned.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Если n > 0 && n < size(), позиция первого символа N-й суб-матч возвращается.
Original:
If n > 0 && n < size(), the position of the first character of nth sub-match is returned.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
если n >= size(), позиция первого символа непревзойденной матча возвращается.
Original:
if n >= size(), a position of the first character of the unmatched match is returned.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Содержание |
[править] Параметры
| n | - | целое число указания, которые соответствуют изучить
Original: integral number specifying which match to examine The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[править] Возвращаемое значение
Позиция первого символа указанного матча или суб-матч.
Original:
The position of the first character of the specified match or sub-match.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[править] Пример
#include <iostream> #include <regex> #include <string> int main() { std::regex re("a(a)*b"); std::string target("aaab"); std::smatch sm; std::regex_match(target, sm, re); std::cout << sm.position(1) << '\n'; }
Вывод:
1
[править] См. также
| возврат указанных суб-совпадают Original: returns specified sub-match The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (public функция-член) | |