I am a beginner in the world of regular expressions. Despite my efforts to find a solution for my specific case, I have not been successful. I have tested several ideas that I came across, but none of them have worked for me.
I have a unique repetitive pattern that I have attempted to match. While I have made progress, I have not yet found the exact solution. Here is the RegEx I have used:
/((([a-zA-IK-Z][a]?)[\d]{1,3}[a-zA-Z]?)(-)?){1,}/g
My pattern examples:
Aa200-B300-M52A-G5-Aa50 (matches as expected)
Aa200-B300-M52A-G5-A (does not match as expected)
Aa200-B300-M52A-G5-Aa (does not match as expected)
While this pattern works well for most cases, I want it to exclude scenarios like the following example:
Aa200-B300-M52A- (ending with -)
What is the best approach to achieve this desired outcome?