[Scilab-users] Regex problem

Gerhard Kreuzer gerhard.kreuzer at liftoff.at
Fri Aug 26 20:38:55 CEST 2016


Hi Jan,

 

that is a nice idea, basically.

The meta data (= ascii) coming first and after that I have binary data.

Now I can read character by character, as you did and stop at the first non ascii character.

Now I only have ascii characters in my strData variable and regex should work.

And this method automatically adapt itself to any length of meta data, so this also works for  me. The length of  the binary data block can be calculated from the meta data and this way I found the next starting point for  the next meta data block.

 

I immediately start coding …

 

Thanks

 

With best regards

 

Gerhard

 

Von: JLan [via Scilab / Xcos - Mailing Lists Archives] [mailto:ml-node+s994242n4034504h24 at n3.nabble.com] 
Gesendet: Freitag, 26. August 2016 19:09
An: Gerhard Kreuzer
Betreff: Re: Regex problem

 

Gerhard

Would this work? Read as much as you need as binary and convert the non ascii values to an ascii value, for instance 0. 

The below is not optimized, and I have no idea why the strsplit is needed, but I got an "unknown error" without it:

fid=mopen(datafile,"rb");
btr=1000;
B=mgeti(btr+1,"uc",fid);
for i=1:btr+1
        if B(i)>128 | B(i)<32 then B(i)=48; end
end
S=strsplit(ascii(B),btr);
strData=S(1);

[dataStart,dataEnd,dataMatch,data]=regexp(strData,'/#data#/') 
...
Jan Å

_______________________________________________ 
users mailing list 
[hidden email] 
http://lists.scilab.org/mailman/listinfo/users



  _____  

If you reply to this email, your message will be added to the discussion below:

http://mailinglists.scilab.org/Scilab-users-Regex-problem-tp4034446p4034504.html 

To unsubscribe from [Scilab-users] Regex problem, click here <http://mailinglists.scilab.org/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4034446&code=Z2VyaGFyZC5rcmV1emVyQGxpZnRvZmYuYXR8NDAzNDQ0NnwtMTk4MzI4ODE5Mg==> .
 <http://mailinglists.scilab.org/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> NAML 





--
View this message in context: http://mailinglists.scilab.org/Scilab-users-Regex-problem-tp4034446p4034506.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20160826/2357db0a/attachment.htm>


More information about the users mailing list