JS MAC address regular expression

Time:2021-7-30
Copy codeThe code is as follows:
function CheckForm2()
{
//MAC address regular expression
var reg_name=/[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}:[A-F\d]{2}/;
if(!reg_name.test(document.form2.mac.value)){
Alert (“MAC address format is incorrect! MAC address format is 00:24:21:19: BD: E4 “);
document.form2.mac.focus();
return false;
}
return true;
}

Recommended Today

The selector returned by ngrx store createselector performs one-step debugging of fetching logic

Test source code: import { Component } from ‘@angular/core’; import { createSelector } from ‘@ngrx/store’; export interface State { counter1: number; counter2: number; } export const selectCounter1 = (state: State) => state.counter1; export const selectCounter2 = (state: State) => state.counter2; export const selectTotal = createSelector( selectCounter1, selectCounter2, (counter1, counter2) => counter1 + counter2 ); // […]