Anytime you have to dither floating number strings its not a trivial feat.
This just takes your last regex and adds some extra stuff to the lookbehind.
This secures that the engine won't bypass a number just to match the regex.
# (?<!GR)(?<!SS)(?<![.\d])\d*\.?\d+
# (?<! GR | SS | [.\d] )
(?<! GR )
(?<! SS )
(?<! [.\d] )
\d* \.? \d+
Perl test case
@ary = (
'FSTCAR.5_13UNC_1.00 ',
'FSTCAR.5_13UNC_1.00GR5P',
'FSTCAR.5_13UNC_1.00SS316'
);
foreach $fname (@ary)
{
print "filename: $fname\n";
while ( $fname =~ /(?<!GR)(?<!SS)(?<![.\d])\d*\.?\d+/ig ) {
print " found $&\n";
}
}
Output >>
filename: FSTCAR.5_13UNC_1.00
found .5
found 13
found 1.00
filename: FSTCAR.5_13UNC_1.00GR5P
found .5
found 13
found 1.00
filename: FSTCAR.5_13UNC_1.00SS316
found .5
found 13
found 1.00