Hi Pablo,<br>thanks for the quick reply! <br>You have understand exactly my problem: i'm reading the data from a custom network protocol.<br><br>So i will use the binaries.<br>Thanks again,<br>M.Canato<br><br><br><br><div class="gmail_quote">
On Wed, May 21, 2008 at 9:48 PM, Pablo Polvorin <<a href="mailto:pablo.polvorin@gmail.com">pablo.polvorin@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
instead of regular expression, I would suggest to use pattern matching instead:<br>
1> A = <<"OK 01 xxxxxxxx\r\n">>.<br>
<div class="Ih2E3d"><<"OK 01 xxxxxxxx\r\n">><br>
</div>2> <<"OK 01",X/binary>> = A.<br>
<div class="Ih2E3d"><<"OK 01 xxxxxxxx\r\n">><br>
</div>3> X.<br>
<<" xxxxxxxx\r\n">><br>
<br>
besides that, if what you are parsing is some sort of network<br>
protocol, you won't want to represent strings as lists(), but use<br>
binaries like in the previous example.<br>
<br>
<br>
2008/5/21, Matteo <<a href="mailto:mcanato@gmail.com">mcanato@gmail.com</a>>:<br>
<div><div></div><div class="Wj3C7c">> Hi to all,<br>
> i'm a noob of erlang programming. I would like to have some infos about<br>
> extracting a substring from a string....<br>
> Or better, my situation is this:<br>
><br>
> i have a string:<br>
> str="OK 01 xxxxxxxx\r\n"); // where xxxxxxxx is a string that i dont know<br>
> and every time change...<br>
><br>
> and i need to extract the "xxxxxxx" into another string (str2 for exaple).<br>
><br>
> Sorry for my english.<br>
><br>
> Best regards<br>
> M.Canato<br>
><br>
<br>
<br>
</div></div>--<br>
<font color="#888888">--<br>
pablo<br>
<a href="http://ppolv.wordpress.com" target="_blank">http://ppolv.wordpress.com</a><br>
----<br>
</font></blockquote></div><br>