help with regex needed

后端 未结 4 1786
失恋的感觉
失恋的感觉 2021-01-21 02:39

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

4条回答
  •  悲&欢浪女
    2021-01-21 03:06

    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."

提交回复
热议问题