<div class="gmail_quote">On Sat, Jun 4, 2011 at 00:46, 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">15 minutes ago, Rodolfo Carvalho wrote:<br>
> Hello,<br>
><br>
> Since I'm on regexps... next message!<br>
><br>
> I couldn't find a way to match groups.<br>
> I'd like to have something like this:<br>
><br>
> (define t "<br>
> 23 12<br>
> 15 45<br>
> 32 27")<br>
> (regexp-match-groups* #px"(\\d+)\\s+(\\d+)" t)<br>
><br>
> => '(("23" "12") ("15" "45") ("32" "27"))<br>
><br>
> Does such a thing exist?<br>
<br>
</div>No. You can do this:<br>
<br>
(regexp-match* #px"(\\d+)\\s+(\\d+)" t)<br>
<br>
where regexp-match gives you all of the complete matches, but not the<br>
matched groups. It could be added, but it seems like a questionable<br>
extension.<br>
<div class="im"><br></div></blockquote><div><br></div><div><br></div><div><br></div><div><br></div><div>So then how useful are groups? Only to re-match them?</div><div>Like "(quack)\\1"...</div><div><br></div><div>
<br></div><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>
> I am trying to parse the output from a HPL benchmark result, which is<br>
> composed by many blocks of the following:<br>
><br>
> T/V N NB P Q Time<br>
> Gflops<br>
> --------------------------------------------------------------------------------<br>
> WR00L2L4 29293 256 2 4 535.64<br>
> 3.129e+01<br>
> --------------------------------------------------------------------------------<br>
> ||Ax-b||_oo/(eps*(||A||_oo*||x||_oo+||b||_oo)*N)= 0.0034782 ......<br>
> PASSED<br>
> ================================================================================<br>
><br>
><br>
> Maybe there is a better way other than using regexps?<br>
<br>
</div>Why not read it line-by-line, then parse each line with a regexp?<br></blockquote><div><br></div><div><br></div><div>I wouldn't be a bad idea. I can filter-out non-matching lines and split the rest... oh yes, since I have things split by spaces I can use regexp-split :)</div>
<div><br></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
<br>
> Actually it would be nice to have some kind of reader that know how to read<br>
> and convert "3.129e+01" from scientific notation to regular number which I<br>
> could operate with.<br>
<br>
</div>-> (read (open-input-string "3.129e+01"))<br>
31.29<br><br></blockquote><div><br></div><div>And is there a way to integrate that with reading the output from the regexp?</div><div>Something like a "scanf"? </div><div><br></div><div>Ok, don't tell me, I will figure out in the next minutes :D</div>
<div><br></div><div>[]'s</div><div><br></div><div>Rodolfo Carvalho</div></div><br>