LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

match pattern from text file

Solved!
Go to solution

hi,

im using labview 12.0.im still new using labview. i want to extract a type of same information from text file using match pattern. but it could not give out any result.at first im using data string directly from output of system exec.vi and it run just nice in term of extracting the information that i want. but when i try using read from text file string, it could not give out any output.is it because they have different type of string?the text and result read correctly from text file.

Capture1.PNG

0 Kudos
Message 1 of 11
(5,399 Views)

Can you post your VI. There's something cannot be checked from screenshot. Attach text file also.

0 Kudos
Message 2 of 11
(5,395 Views)

this r the vi and text file..

Download All
0 Kudos
Message 3 of 11
(5,374 Views)
Solution
Accepted by topic author ikaloopy

Right-click the read function and uncheck "convert EOL". See if this solves your problem.

0 Kudos
Message 4 of 11
(5,370 Views)

@altenbach: uncheck "convert EOL"

 

or use \n in place of \r

0 Kudos
Message 5 of 11
(5,357 Views)

@ouadji wrote:

or use \n in place of \r


This is a pure Rube Goldberg suggestion!

 

The rught way is to read the file verbatim as I suggested.

 

Doing a OS specific EOL conversion followed by a bandaid adjustement to undo it nanoseconds later is not guaranteed to be OS independent, and could blow up on a different OS. Very bad idea leading to fragile code!

0 Kudos
Message 6 of 11
(5,353 Views)

"The right way is to read the file verbatim as I suggested."

 

I never said that your solution was not the best.
Mine is just an alternative for this Specific case, nothing else.

 

"This is a pure Rube Goldberg suggestion!"


Smiley Happy  unhelpful and meaningless comment.

0 Kudos
Message 7 of 11
(5,342 Views)

if i want to view in a string with 2 digit number. is it possible to put 0 in front of the 1 digit number as a fixed and for 2 digit just remain as it is?

eg: '2'='02'

      '25'='25'

0 Kudos
Message 8 of 11
(5,335 Views)

Hi

Use the %02d to fill excess characters with 0

 

Mike

0 Kudos
Message 9 of 11
(5,317 Views)

Almost, but not quite. The dot matches any character (except a newline).

 

For something like MAC addresses, your regex would be

 

(\w{1,2}-){5}\w{1,2}

 

That would omit strings with spaces and most punctuation, although strictly, this admits underscores but that one exception would be quite unlikely in this long a pattern.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 10 of 11
(5,309 Views)