Page 1 of 1
Validate field for MAC address
Posted: Tue Mar 14, 2023 12:59 am
by rkopp01234
Hello,
I would like to validate for MAC addresses in the field setup using the follwing format : AA:BB:CC:DD:EE:FF
I was wondering if the following Rexec expression is correct ("Regular Expression" selected for Validate)
Argument (client-side):
"^[0-9a-f]{1,2}([\:])(?:[0-9a-f]{1,2}\1){4}[0-9a-f]{1,2}$"
Thanks!
Re: Validate field for MAC address
Posted: Tue Mar 14, 2023 6:42 am
by MichaelG
Re: Validate field for MAC address
Posted: Tue Mar 14, 2023 3:24 pm
by rkopp01234
Hi Michael,
thanks for the reply.
As it does not work (entering AA:BB:CC:DD:EE:FF produces an incorrect field error) - do I have to write a custom function in addition, or is it simply enough to enter the string "^[0-9a-f]{1,2}([\:])(?:[0-9a-f]{1,2}\1){4}[0-9a-f]{1,2}$" into the Argument (client-side) field?
Thanks!
Re: Validate field for MAC address
Posted: Tue Mar 14, 2023 3:32 pm
by rkopp01234
Sorry it should of cause be lower case: aa:bb:cc:dd:ee:ff, but this is still giving me the incorrect field error).
Re: Validate field for MAC address
Posted: Tue Mar 14, 2023 3:34 pm
by rkopp01234
I can test the string ^[0-9a-f]{1,2}([\:])(?:[0-9a-f]{1,2}\1){4}[0-9a-f]{1,2}$ successfully in
https://regex101.com/r/tJ2mW5/12
Re: Validate field for MAC address
Posted: Wed Mar 15, 2023 8:34 pm
by MichaelG
Note that client side regular expression should be enclosed by "/", see Validation (for Add/Copy/Edit/Search) -> Arguments (Client-side).