Jump to content

[SOLVED] help with mac address


solarisuser

Recommended Posts

Hello All,

 

I have data in the form of "0:1:22:33:44:55" and "00:11:22:33:44:55".

What I would like to figure out is how to have regex modify the first example to add a "0" in front of any single digit or alpha character, and leave the parts with two numbers or alphas alone.  The ":" is always going to be a delimiter.

 

For example, the first example above should convert to "00:01:22:33:44:55".

 

Any assistance would be appriciated - I have basic regex experience and use google to figure out basic stuff but I dunno how I would start this.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/58658-solved-help-with-mac-address/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.