I understand how to match it but I don’t know the criteria for example, Email matcher would use: /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/ but I need to know what a steam id would use.
Demo Steam ID: STEAM_0:1:20206720
Could someone give me a criteria for STEAM IDs?
EDIT:
I’m using the regex expression provided by pimvdb, but it still replys that a steam id(STEAM_0:1:20206720) is incorrect.
My code is below:
function verifySteamID(){
var elem = document.getElementById('item_name');
var emailExp = /^STEAM_[0-5]:[01]:\d+$/;
if(elem.value.match(emailExp)){
document.getElementById("error").setAttribute("class", "hidden");
return true;
}else{
document.getElementById("error").setAttribute("class", "unhidden");
elem.focus();
return false;
}
}
Which is called by:
<input type="submit" value="Donate" id="donatebtn" onclick="return verifySteamID()" />
According to http://developer.valvesoftware.com/wiki/SteamID#Format it might be something along the lines of:
^...$is just so that the exact string must match.STEAM_is the prefix.After the prefix there should be one number ranging from 0 to 5.
Then a
:followed by either a 0 or 1.Then another
:followed by the account number.