Validate field for MAC address

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
rkopp01234
User
Posts: 23

Validate field for MAC address

Post 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!


MichaelG
User
Posts: 1095

Post by MichaelG »

Yes, it looks good.


rkopp01234
User
Posts: 23

Post 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!


rkopp01234
User
Posts: 23

Post 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).


rkopp01234
User
Posts: 23

Post 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


MichaelG
User
Posts: 1095

Post by MichaelG »

Note that client side regular expression should be enclosed by "/", see Validation (for Add/Copy/Edit/Search) -> Arguments (Client-side).


Post Reply