title: Extract the version from the string using python?
body: <p>Extract the version number from the below-given string:</p>
  <pre><code>String 1: ROM: System Bootstrap, Version 12.2(50r)SYS3, RELEASE SOFTWARE (fc1)
  Output: 12.2
  Desired Output: 12.2(50r)SYS3
  
  String 2: ROM: IOS-XE ROMMON
  Output : 
  Desired Output: IOS-XE ROMMON
  
  String 3: ROM: 15.1(1r)SG18
  Output: 15.1
  Desired Output: 15.1(1r)SG18
  </code></pre>
  <p>Using the code below I got above output:</p>
  <pre><code>def version_parser(v):
      versionPattern = r'\d+(=?\.(\d+(=?\.(\d+)*)*)*)*'
      regexMatcher = re.compile(versionPattern)
      return regexMatcher.search(v).group(0)
  </code></pre>
  <p>I want a single simplified code that I can apply in all three cases.</p>