4
I have my regex (\d{2})
.
And I got my string 12 hoje vai 45 na serra pelada 55 ou 75
.
How do I get my regex to pick up all occurrences of the string? It’s only picking up the last one.
4
I have my regex (\d{2})
.
And I got my string 12 hoje vai 45 na serra pelada 55 ou 75
.
How do I get my regex to pick up all occurrences of the string? It’s only picking up the last one.
3
(\d{2})*
for 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.
}
Browser other questions tagged c# regex
You are not signed in. Login or sign up in order to post.
What matters is to iterate
Matches
. Add + or * not required.– acelent