.NET Regular expressions on bytes instead of chars
        Posted  
        
            by brickner
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by brickner
        
        
        
        Published on 2010-06-12T13:09:51Z
        Indexed on 
            2010/06/12
            13:12 UTC
        
        
        Read the original article
        Hit count: 377
        
Hi,
I'm trying to do some parsing that will be easier using regular expressions.
The input is an array (or enumeration) of bytes.
I don't want to convert the bytes to chars for the following reasons:
- Computation efficiency
- Memory consumption efficiency
- Some non-printable bytes might be complex to convert to chars. Not all the bytes are printable.
So I can't use Regex.
The only solution I know, is using Boost.Regex (which works on bytes - C chars), but this is a C++ library that wrapping using C++/CLI will take considerable work.
How can I use regular expressions on bytes in .NET directly, without working with .NET strings and chars?
Thank you.
© Stack Overflow or respective owner