I am fairly new to Programming world. I am trying to create a common regex that would match only list of strings given, nothing more than that.
For Eg., given the below list
List = ['starguide,'snoreguide','snoraguide','smarguides']
It should create a regex like this - s(((tar|nor(e|a))(guide))|marguides)
I implemented a trie. Could only manage to get s(marguides|nor(aguide|eguide)|targuide)
I want my regex to be shortened (common suffixes tied together). Is there any better way to shorten the regex I am getting from the trie?