title: Python - how to read the remainder of a string after a match has been found
body: <p>I would like to be able to find a second match within serial data using the re.search method. So far I've been able to use the re.search regular expression to find the first match.</p>
  
  <p>How would I go about looking for the letters PR and print the digits to the right of it after finding the first match in the same serial string?</p>
  
  <p>The code below shows connection to a device through a COM port.
  Stores the data to serial and looks for the digits to the right of the word 'ID' on the same line. </p>
  
  <p>serial data: aassddffggID:12345qqwweerrttPR:54321zzxxxcc   </p>
  
  <pre><code>ser = serial.Serial('COM1', 115200, timeout=0, parity=serial.PARITY_NONE, 
  stopbits=serial.STOPBITS_ONE, rtscts=0)
  print(ser)
  time.sleep(0.5)
  serial = ser.read(9999)
  
  match = re.search('ID:(\d*)', serial)
  print(match.group(0))
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>I would like to modify this re.search to allow parameters to be passed to ID and PR. I have been able to pass a value to ID but can't seem to get values passed to both without error. </p>
  
  <p>This bit works...</p>
  
  <p>id = 12345
  pr = 54321</p>
  
  <pre><code>if re.search(r"ID:{}".format(id), serial)
      print("ID match found")
  else:
      print("ID match not found")
  
  #output
  "ID match found"
  
  #For both ID and PR I've tried
  if re.search(r"ID:{}".format(id)."PR:{}".format(pr), serial)
      print("PR match found")
  else:
      print("PR match not found")
  
  #output
  "SyntaxError: invalid syntax" 
  </code></pre>
  
  <p>Note. It doesn't like the inverted commas after curly brackets have closed after PR:{}</p>
  
  <p>Any suggestions on changes to the syntax?</p>