ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

search string

Solved!
Go to solution

Hi,

 

I have get the attached file details from command prompt.

 

I would like to know, is there any method can get the mac address string only? Which is "00-04-A3-12-32-25" and filter out the others detail.

 

Thanks.

0 Kudos
Message 1 of 10
(5,215 Views)

Regex to the rescue.

 

MacAddressRegex.png

0 Kudos
Message 2 of 10
(5,204 Views)

Between, my labview version is 8.5.1. Thanks

0 Kudos
Message 3 of 10
(5,199 Views)
Solution
Accepted by topic author TanTan

You can just paste this regex into the constant for Match Regular Expression

 

([[:xdigit:]]{2}-){5}[[:xdigit:]]{2}

 

8.5 vi attached

0 Kudos
Message 4 of 10
(5,194 Views)

Oh, thank you. My problem is solved.

 

Between, may i know where can i get the definition for all these regular expression? ([[:xdigit:]]{2}-){5}[[:xdigit:]]{2}

 

Thanks.

0 Kudos
Message 5 of 10
(5,186 Views)

I always refer to this page:  www.pcre.org

 

In this case: ([[:xdigit:]]{2}-){5}[[:xdigit:]]{2} translates to:

 

Look for 2 hex digits followed by -, all repeated 5 times followed by two more hex digits.

0 Kudos
Message 6 of 10
(5,178 Views)

Hi Darin,

 

Thanks for your information and the solution.

 

Have a nice day.

0 Kudos
Message 7 of 10
(5,174 Views)

Hi,

 

I have one more step to do. If I would like to filter out the '-' in between the number from attached vi. How can i do it?

 

Example:

From: 00-04-A3-12-32-25


To: 0004A3123225

 

Appreciate your feedback.

 

Thanks.

0 Kudos
Message 8 of 10
(5,085 Views)
Use Search and Replace on the Mac address string, search for '-' and leave the replace string blank. Be sure to set Replace All to true.
0 Kudos
Message 9 of 10
(5,065 Views)

Hi Darin,

 

Yeah this is exactly the solution. I have solved my problem.

 

Thanks.

0 Kudos
Message 10 of 10
(5,060 Views)