On Thursday 21 October 2004 10:49 pm, trans. (T. Onoma) wrote:
| On Thursday 21 October 2004 10:21 pm,
wrote:
| | Hi,
| |
| | At Fri, 22 Oct 2004 10:38:24 +0900,
| |
| | trans. (T. Onoma) wrote in [ruby-talk:117331]:
| | > # example data
| | > str = "some string abc xyz"
| | > tokens = [ /abc/, /xyz/ ]
| |
| | str.index(/#{tokens.join("|")}/)
Actually, I'm still playing with it, but it looks like this won't work b/c I
have subexpressions in my actual tokens. e.g.
[ /()(abc)(\S)/, ... ]
And the match indexes seem to get lost when I join them. Also, I'm not sure
how to tell which token it was that actually matched.
I'll keep at it. Thanks again.
T.