Is there any way to achieve what I am trying?
Yes, of course. How do you think all those RFID systems work?
char tagString[13];
int index = 0;
byte tag;
boolean reading = false;
if (SoftSerial.available() > 0)
{
while (SoftSerial.available())
{
int readByte = SoftSerial.read();
if (readByte == 2) reading = true;
if (readByte == 3) reading = false;
if (reading && readByte != 2 && readByte != 10 && readByte != 13)
{
tagString[index] = readByte;
index++;
}
}
Serial.write(tagString);
Serial.println();
This is wrong on at least three counts.
First, you don't terminate the string with 0x00. Thus you get garbage at the end.
Second, you assume that after reading
some bytes you have the entire tag. Which you almost certainly won't.
Third, you keep adding to tagString without checking if you have put more than 13 characters into it.
http://www.gammon.com.au/serial