LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

search and replace string formatting

Solved!
Go to solution

Hi,

I am trying to do a search and replace formatting of a string.

In the example I am looking for string "PASSED" but it must also start with usbflash and some number + PASSED.

I can't get the format to have a number from 1-99. The number of replacements should add up to 6 in this case. I have tried with \d for any number, and I also tried [1-99].

0 Kudos
Message 1 of 10
(4,339 Views)

Please post the VI that you have tried so far along with the String input (In 2011 LV version please).

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 10
(4,301 Views)

Try this attached file.   Robot Happy

0 Kudos
Message 3 of 10
(4,291 Views)

You could use Scan From String with a format of %d.  That will read off the number and the remaining string should then be "PASSED".


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 10
(4,277 Views)

Attachment - stringtest

My attachment is not uploading ! Smiley Frustrated

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

@hasse wrote:

Attachment - stringtest

My attachment is not uploading ! Smiley Frustrated


Try zipping up your VI and posting that.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 10
(4,241 Views)

frontpanel.jpgblockdiag.jpg

0 Kudos
Message 7 of 10
(4,233 Views)

I don't know why it's not working to upload ether ,zip or a vi?

I uploaded 2 images for the front panel and block diagram. Hope you can read it!

0 Kudos
Message 8 of 10
(4,229 Views)
Solution
Accepted by topic author hasse

Right click on the Search And Replace String function.  There is an option to use Regular Expressions.  Then give this a try.

 

EDIT: You will need to set the Replace All input to TRUE.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 9 of 10
(4,226 Views)

Thank you crossrulz!

I had it set as regular expression - it was the plus sign that was missing.

Smiley Happy

0 Kudos
Message 10 of 10
(4,218 Views)