What is the regex to match alphanumeric 6 character words, separated by space or comma

I am newbie in RegEx and trying to design a RegEx which could match the String like below:

pattern 1 separated by comma and a space: KEPM39, JEMGH5, HEPM21 … (repeat)

pattern 2 separated only by a space: KEPM39 JEMGH5 HEPM21 … (repeat)

pattern 3 separated only by a comma: KEPM39,JEMGH5,HEPM21 … (repeat)

this is my concept: "^[a-zA-Z0-9]{6,}[,\s]+$" but it seems wrong.

#I want to validate the whole string, and I use javascript & html to validate user input. (textarea)

#duplicate change to repeat to be more suitable.

function validate(){
    var term = "JEPM34, KEPM11 ";
    var re = new RegExp("^[a-zA-Z0-9]{6,}[,\s]+$");
    if (re.test(term)) {
        return true
    } else {
        return false
    }
}

thanks you in advance!

71 thoughts on “What is the regex to match alphanumeric 6 character words, separated by space or comma”

  1. Everything is very open with a very clear clarification of the issues.
    It was really informative. Your website is very useful. Thank you
    for sharing!

    Reply
  2. Howdy this is kinda of off topic but I was wanting to know if blogs use WYSIWYG editors or if you have
    to manually code with HTML. I’m starting a
    blog soon but have no coding expertise so I wanted to get advice from someone with experience.

    Any help would be enormously appreciated!

    Reply
  3. Hey! Someone in my Myspace group shared this website with us so I came to look it over.

    I’m definitely enjoying the information.
    I’m book-marking and will be tweeting this to my followers!
    Wonderful blog and outstanding design and style.

    Reply
  4. I’m impressed, I must say. Seldom do I come across a blog that’s both educative and amusing, and let me tell you, you’ve hit the nail on the head.
    The issue is something that too few folks are speaking intelligently about.
    I am very happy that I found this in my hunt for something concerning this.

    scoliosis surgery https://0401mm.tumblr.com/ scoliosis surgery

    Reply