regex in textfield

Posted by klox on Stack Overflow See other posts from Stack Overflow or by klox
Published on 2010-06-10T04:15:31Z Indexed on 2010/06/10 4:22 UTC
Read the original article Hit count: 312

Filed under:
|

dear all..i have this code:

<script>
var str="KD-R435MUN2D";
var matches=str.match(/(EE|[EJU]).*(D)/i);
if (matches) {
     var firstletter = matches [1];
     var secondletter = matches [2];
     var thirdletter = matches [3];
alert(firstletter + secondletter + thirdletter);
}else{
      alert (":(");
}
</script>

i want it can control a textfield <input type="text" id="mod">..how must i do?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about regex