A
Alex DeCaria
I know how to use regular expressions to find the first match of a
pattern in a string. But, how do I most easily find multiple matches?
For example, if the string is
s = 'abcde_abcde_abcde'
and I want to find the location of ALL the 'b' characters, how do I do
it? If I use
m = s.match(/b/)
then m.offset(0) => [1,2]
but I don't have any information about the second or third occurences of
'b'.
--Alex
pattern in a string. But, how do I most easily find multiple matches?
For example, if the string is
s = 'abcde_abcde_abcde'
and I want to find the location of ALL the 'b' characters, how do I do
it? If I use
m = s.match(/b/)
then m.offset(0) => [1,2]
but I don't have any information about the second or third occurences of
'b'.
--Alex