Hi,
first of all: i have absolutely no experience with regular expressions, and just a little bit with java script. :-|
The Task: I have a HTML form (name "Sensors") where a special sensor ID has to be entered : <INPUT type="text" size="40" maxlength="16" name="Sensor1_ID" value=""/>
I need to check the content of the text field with following rules:
- The Sensor-ID must have 16 characters
- Only HEX values are allowed (0-9 a-f A-F)
- The last two characters (position 15+16) must be "10" or "28".
What i currently have:
Following JavaScript checks (OnSumbit) the content of the text field:
function CheckSensor () {
if (document.Sensors.Sensor1_ID.value.length != 16) {
alert("Invalid ID!")
document.Sensors.Sensor1_ID.focus();
return false;
}
}
What i need:
Add a regular expression for condition 2 and 3.
Thank you in advance!