I need to scan larger text documents for patterns expressed in regular expressions and extrac开发者_StackOverflow社区t a certain number of surrounding text tokens. At the moment I use String.scan to retrieve the matches, but this doesn't give me the position of the matched string in the document. Is there some elegant solution for this?
Check out this post.
It works on a match object. m.begin(1)
精彩评论