Javascript regular expressions problem

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-03-16T17:13:30Z Indexed on 2010/03/16 17:21 UTC
Read the original article Hit count: 145

Hello!

I am creating a small yatzy game and i have run into some regex problems. I need to verify certain criteria to see if they are met. The fields one to six is very straight forward the problem comes after that. Like trying to create a regex that matches the ladder. The Straight should contain one of the following characters 1-5. It must contain one of each to pass but i can't figure out how to check for it. I was thinking /1{1}2{1}3{1}4{1}5{1}/g; but that only matches if they come in order. How can i check if they don't come in the correct order?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about regex