Combination of 5 or 6 letters and digits

I have this text:

Lorem ipsum dolor AA99BC sit amet, consectetur adipiscing elit,
sed do eiusmod 3FGF44 tempor incididunt ut labore et dolore magna
aliqua. NLGG21 Ut enim ad

I want to get only the bold marked strings. The conditions are:

  1. String should contain 6 or 7 characters in total
  2. String should contain only letters and digits
  3. All letters and digits are allowed

Language used is PCRE syntax in Feature Manipulation Engine (FME). FME is based upon Python.
https://perldoc.perl.org/perlre

Could you help me out with this?

>Solution :

This pattern should match as expected:

\b(?=\w*\d+\w*)\w{6,7}\b

Leave a Reply