wasabi3689
asked on
MAC address format
I want my input MAC address (always 12 charators) as the following
1. xx:xx:xx:xx:xx:xx ( separated with : )
2. xx-xx-xx-xx-xx-xx ( separated with - )
3. xx.xx.xx.xx.xx.xx ( separated with . )
4. xxxxxxxxxxxx ( no separated )
5. xxxxxxxxxx-xx ( last two charators separated with -)
The output always is xx:xx:xx:xx:xx:xx ( separated with : )
Here is my code
in my jsp file
<input id="txtMAC" type="text" name="MACAddress" size="17" maxlength="25" onchange="toggleVisibility (2);">
<br>
in my java file
MyMAC = MyMAC.replaceAll("(\\w{2}) ", "$1:");
MyMAC = MyMAC.substring(0, MyMAC.length() - 1);
I want to know how I edit my code so that the jsp accept the input format but the output always xx:xx:xx:xx:xx:xx ( separated with : )
1. xx:xx:xx:xx:xx:xx ( separated with : )
2. xx-xx-xx-xx-xx-xx ( separated with - )
3. xx.xx.xx.xx.xx.xx ( separated with . )
4. xxxxxxxxxxxx ( no separated )
5. xxxxxxxxxx-xx ( last two charators separated with -)
The output always is xx:xx:xx:xx:xx:xx ( separated with : )
Here is my code
in my jsp file
<input id="txtMAC" type="text" name="MACAddress" size="17" maxlength="25" onchange="toggleVisibility
<br>
in my java file
MyMAC = MyMAC.replaceAll("(\\w{2})
MyMAC = MyMAC.substring(0, MyMAC.length() - 1);
I want to know how I edit my code so that the jsp accept the input format but the output always xx:xx:xx:xx:xx:xx ( separated with : )
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes. after that line
ASKER
MyMAC = MyMAC.replaceAll("(\\w{2})
MyMAC = MyMAC.substring(0, MyMAC.length() - 1);