Hi all,
I search a pattern in a string. How do I know how many times the pattern
is found/matched?
Thanks,
Li
Hi all,
I search a pattern in a string. How do I know how many times the pattern
is found/matched?
Thanks,
Li
Li Chen wrote:
I search a pattern in a string. How do I know how many times the pattern
is found/matched?
string.scan(pattern).length
HTH,
Sebastian
Sebastian H. wrote:
Li Chen wrote:
I search a pattern in a string. How do I know how many times the pattern
is found/matched?string.scan(pattern).length
HTH,
Sebastian
Thanks,
Li
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs