From: Scott Rubin Date: 2004-12-15T23:47:15+09:00 Subject: Regex extraction Hello, I'm writing an application that parses log files, specifically gaim html log files, extracts any links it finds and creates an RSS feed of those links. I have a working program that's about 60 lines of ruby, but it is far from perfect. Most of the necessary fixes and improvements are things I know how to do, but just take time. But there are a couple things I need help with. First, in ruby, how do I extract parts of a regex? Let's use the example from my program. Normally I could use an expression like the following href\s*=\s*?:(\"?[^\"]*)\") And this would allow me to get the out of the expression. But this doesn't seem to work in ruby, or at least I don't know how to make it work in ruby. What I would really like to do is match the entire and the into three string variables. And I have to extract this entire structure from any random line of text in which the structure either exists or does not. I'm guaranteed that it wont be partial i.e: an without a . The other thing I don't know how to do is replace things like & with &. Is there anything in the ruby standard library, maybe in rexml, that automatically takes care of all those standard entities for me? I looked, but I couldn't find one. Thanks a lot, Scott Rubin