<div class="gmail_quote">On Sat, Jun 4, 2011 at 01:16, Eli Barzilay <span dir="ltr"><<a href="mailto:eli@barzilay.org">eli@barzilay.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">[...]</div><div class="im">
><br>
> So then how useful are groups? Only to re-match them?<br>
> Like "(quack)\\1"...<br>
<br>
</div>No, you get the groups results when you do a simple `regexp-match'.<br>
It just happens that `regexp-match*' was made to return the complete<br>
matches, it could have returned the subgroups too. Like I said, it<br>
could be added -- but every use that I've seen was one that got more<br>
benefit from restructuring the code differently. (As is in your<br>
case.)<br></blockquote><div><br></div><div><br></div><div>I think I didn't understand well when I would use `regexp-match' with groups.</div><div>It seems to return only the first match (as I expect) and the subgroups come as the last elements of the list.</div>
<div><br></div><div>Since I want to find all the occurrences of a pattern, it seemed to me `regexp-match*' was more appropriate.</div><div><br></div><meta http-equiv="content-type" content="text/html; charset=utf-8"><meta http-equiv="content-type" content="text/html; charset=utf-8"><div>
<br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
<br>
> > -> (read (open-input-string "3.129e+01"))<br>
> > 31.29<br>
<br>
</div>Actually, I should have used the easier answer:<br>
<br>
(string->number "3.129e+01")<br></blockquote><div><br></div><div><br></div><div>I think it's time for me to go to sleep... string->number would definitely do, much better, thanks.</div><div> </div><div>
<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
<br>
> And is there a way to integrate that with reading the output from<br>
> the regexp? Something like a "scanf"?<br>
<br>
</div>I'm not sure that I'm following that, but you could just do something<br>
like this:<br>
<br>
-> (map string->number (regexp-match* #rx"[^ ]+" "1.23 4e2"))<br>
'(1.23 400.0)<br><br></blockquote><div><br></div><div>Well, that's not what I need, because I would lose the notion of a "line". I want to do a "table filtering". The data is full of unuseful verbosity and I intend to grab just the numbers and sort by the last column :D</div>
<div><br></div><div>For now I have (map parse-line (regexp.... )) where parse-line maps string->number to a single line.</div><div><br></div><div>I can get along without removing columns, but anyway I don't see now a clean way to filter-out some columns without writing dirty code :D</div>
<div><br></div><div><br></div><div> </div></div><br>