I'm updating my code in way that if there is a malformed string no search will happen. 
if (parsed) {
   //do calculation
} else {
   return;
   //so whenever we are getting an unparsed string we are just ignoring 
}
is it okay?