[17] => Link_Info-mc1.7.10-0.3.1.litemod
[18] => Mantle-1.7.10-0.3.2.jar
[19] => MicdoodleCore-1.7-3.0.11.333.jar
[20] => MineTweaker3-1.7.10-3.0.9C.jar
[21] => ModTweaker 2-0.8.0.jar
[22] => MouseTweaks-2.4.4-mc1.7.10.jar
[23] => NEIIntegration-MC1.7.10-1.0.9.jar
[24] => NotEnoughItems-1.7.10-1.0.5.110-universal.jar
I've got some of these elements in my PHP Array and I need to extract all except:
-1.7.10-1.0.5.110-universal.jar
So I tried to use regular expression like this:
/[\d\-|\.]*\.jar/
But it extracts modname only from string like this Example2-0.8.0.jar.
So I need to make it more flexible.
If I understand it correctly, you want to match every filename except the one containing 'universal'. To do so, you can use negative lookbehind with a pattern like this:
/[\w\d\-|\._ ]*(?:(?<!universal)(\.jar)|(\.litemod))/
DEMO: https://regex101.com/r/mI2fM8/3
In case you just want to match the name (without version number, ...) something like this should be enough:
/^[^\- ]+/