title: Is it a bad idea to convert byte arrays to strings then parse with regular expressions?
body: <p>Here's the scenario: I've been recently tasked to write a rs232 serial device communication interface for our existing application.  This application has base classes in place to do the actual communication.  Basically all I do is accept a byte array into my class then process it.</p>
  
  <p>Part of the issue is that the byte array delivered can be no more than 1000 bytes at a time yet there could be more data waiting to come in that belongs to that transaction.  So I have no idea if what was delivered to me is complete.  What I am doing is converting that 1000 byte array into a string and stuffing it into a buffer.  This buffer then runs a regex to see if what was added creates a complete transaction.  I know it's complete if it matches a particular signature (basically a series of control codes at the beginning and end).  This buffer will only append data up to 3 times before giving up if no match is found in case of garbage data coming in and no match is ever possible.  This isn't a high data volume device so I don't expect tons of data to come pouring in constantly.  And the regular expression is only ever executed on, at most, 3000 characters.</p>
  
  <p>So far it works pretty good, but my question is are regular expressions terrible for this?  Are there any ramifications in regards to performance for what I'm using them for?  My understanding is that regular expressions are typically bad for large volumes of data but I feel this is quite small.</p>