I have my regex (\d{2})
.
And I have my string 12 hoje vai 45 na serra pelada 55 ou 75
.
How do I get my regex to get all occurrences of the string? She's just getting the last one.
I have my regex (\d{2})
.
And I have my string 12 hoje vai 45 na serra pelada 55 ou 75
.
How do I get my regex to get all occurrences of the string? She's just getting the last one.
(\d{2})*
to zero or more occurrences. (\d{2})+
for one or more occurrences.
To iterate over all occurrences, use:
foreach (Match m in Regex.Matches("12 hoje vai 45 na serra pelada 55 ou 75", "(\d{2})*"))
{
// m.Value mostra o valor encontrado, m.Index o índice na lista de
// expressões encontradas.
}