I have some code that receives data from an OBD-II adapter and runs it through some regex so that I can identify the part that contains the Trouble Codes. This is it.
dataRecieved = readMessage;
RX.setText(dataRecieved);
if((dataRecieved != null) && dataRecieved.matches("\\s*[A-F0-9]{2} [A-F0-9]{2} [A-F0-9]{2} [A-F0-9]{2} [A-F0-9]{2} [A-F0-9]{2}\\s*\r?\n?")) {
if(D) Log.i(TAG, "REGEX ");
dataRecieved = dataRecieved.replace(">", "").trim();
DTC.setText(dataRecieved);
After the regex I set whatever is received to a TextView in android. However, there's no text set when I run it. I don't know if it's the regex I used. It's supposed to detect something like
>
01 00 14 53 00 00
Including or excluding the prompt.