[Scilab-users] ?==?utf-8?q? Regex problem

Antoine Monmayrant antoine.monmayrant at laas.fr
Fri Aug 19 14:00:34 CEST 2016


Hi Gerhard,

One stupid question and one possible workaround:

- 1) Are you sure that your pattern matching is supported by scilab ? Last time I tried, I had issues with capturing groups. I tried your regexpr on https://regex101.com/#pcre and it seems OK.

-2) Do you really need to use regexp? Can't you just go the stupid and brute force way using mopen+mget to scan your binary file and search for #data#, start accumulating binary data and stop when you reach #EOC#, repeat until EOF?

Can you provide use with a test file?

Hope it helps,

Antoine

 
Le Vendredi, Août 19, 2016 13:26 CEST, "Gerhard Kreuzer" <gerhard.kreuzer at liftoff.at> a écrit: 
 
> Hi,
> 
>  
> 
> I have a data file containing metadata and binary data. I successfully
> scanned the file with .net Regex class, now I want to scan it with SciLab,
> but ..
> 
>  
> 
> The relevant part of  the file looks like:  #data# .. here comes binary data
> . #EOC#  .. here comes binary data .  #EOC# .. and so on.
> 
>  
> 
> My regex in .net notation looks like:  #data#((?<data>(?s:.*?))#EOC#)+
>  
> Ok, in SciLab the notation is little different:
> '/#data#((?P<data>(?s:.*?))#EOC#)+/'
>  
> This regex expression didn't match at all. I start experimenting and it
> looks like that the regex engine stops at a new line character (0x0A) which
> i spart of  the binary data block. As far as I know (and that isn't that
> far) the clause (?s:.*?) means, take any character until you find #EOC# but
> as least as possible.
> No interpretation on 0x0A ..
>  
> Any idea how I can parse my file and get the binary data blocks into
> variables, or at least get pointers to  the starting points, so I am able to
> read the binary data with some file read function?
>  
> Thanks a lot for helping
>  
> With best regards
>  
> Gerhard
>  
> 
>  
> 
>  
>




More information about the users mailing list