I need a regular expression for which:
the string is alphanumeric and have exactly 6 characters in the first half followed by hyphen(optional) followed by optional 4 cha
Might be off-topic, but since I am no regex expert at all I often use the txt2regex program which helps building them from textual menus. http://txt2regex.sourceforge.net.
Cannot resist to quote this: "A programmer had a problem. He realised he could solve it using a regular expression. Now he has two problems."