I have a string that is always built likeMfr Part#: MBRB1045G Technologie ... or Mfr Part#: MBRB1545CTT4G Mounting, so there is always Mfr Part#: then the partnumber I want to extract and then this is followed by either Technologie or Mounting entailed by other characters.
How would you extract that partnumber MBRB1045G from this?
This should do the trick:
However, if it’s not important to you to check that the string has that specific pattern, you might also use the simpler expression:
Mfr Part#: ([^ ]+) .*Also note that you may store the pattern object and reuse it for subsequent usages. This will give you a better performance.