LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parse Mac Address with match regular expression

Solved!
Go to solution

Hi Everyone,

 

I have a problem with the Match Regular Expression function,

 

I am trying to parse the response two a arp -a 192.168.0.15 request in order to extract MAC address of this remote IP, I used the following RegEx: ^([0-9a-fA-F]{2}[:-]){5}([0-9a-fA-F]{2})$

 

I am wondering why do I need to do a string subset first to extract only the MAC Address part. Isn't Match Regular Expression function capable of recognizing the RegEx directly in the middle of a string?

 

I only works when I extract the right tring subset as in the picture bellow.

 

Thanks for your answers.

 

 

 

 

0 Kudos
Message 1 of 4
(3,791 Views)
Solution
Accepted by topic author Olivioloyer

Get rid of the "^" in the beginning of your regular expression. You are instructing it to find the pattern at the beginning of the string.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 2 of 4
(3,787 Views)

Hi Mark,

 

Thanks a lot for your answer, I did what you said, and I still see no change.

 

the answer from arp -a is :

 


Interfaz: 192.168.0.16 --- 0xb
  Direcci¢n de Internet          Direcci¢n f¡sica      Tipo
  192.168.0.15          00-04-7e-02-21-10     din mico  

and the whole match output gives nothing ""

 

OK found the answer I also must quit the $ at the end,

 

Thanks a lot Mark,

 

Have a great day

 

 

0 Kudos
Message 3 of 4
(3,782 Views)

Sorry, I should have noticed the "$" as well. Glad it is working for you.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 4
(3,776 Views)