how do you remove delimiters from mac addresses in a line?

You’re already using Regex, so use some more!

re.sub('\\|([A-F0-9]{2})\\|([A-F0-9]{2})\\|([A-F0-9]{2})\\|([A-F0-9]{2})\\|([A-F0-9]{2})\\|([A-F0-9]{2})\\|', '|\\1\\2\\3\\4\\5\\6|', record)

The pattern is long because you need the results of all the captures and repeated captures are overwritten.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top