'What could be the regex for matching 2 different pattern of strings? [closed]

What will be the regex for matching

a1b2c3 and a1b2-c3d40-e34ch both??

** Characters in strings can change



Solution 1:[1]

a1b2(c3|-c3).*

That should working, too.

If you wanna try on your own I can reccomend: https://regexr.com/6ia3e The site is preconfigured with my solution.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Elmar B.