LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

search string

Solved!
Go to solution

Hi,

I am trying to retrieve all the filenames out of this string, and save them into an array.

 

"#LSCRIPT: "netcmd.pyo",9643#LSCRIPT: "main.pyo",1261#LSCRIPT: "filereader.pyo",3022#LSCRIPT: "strategy.pyo",3948#LSCRIPT: "util.pyo",2177#LSCRIPT: "states.pyo",1073#LSCRIPT: "stores.pyo",3136#LSCRIPT: "serialmgr.pyo",7975#LSCRIPT: "netsm.pyo",8429#LSCRIPT: "netmodem.pyo",4915#LSCRIPT: "netmsg.pyo",4965#LSCRIPT: free bytes: 1956068"

 

Can't seem to get the correct scan from string expression. 

Any advice?

 

Thanks

Goose

0 Kudos
Message 1 of 9
(3,862 Views)

Can you post what you have did so far, that will help to support further.

 

Mathan

0 Kudos
Message 2 of 9
(3,858 Views)

Assuming that...

 

The filename is always lower case letters, with extension .pyo,

 

the following regex would work - use Match Pattern for the search...

 

[a-z]*[.]pyo

 

If you want to be sure to find the filename in quotes, add \" at the beginning and end of the regex, but you would then need to remove the quotes from the matched string.

 

You'd loop, progressing through the string,  until there is no match.

 

Rod.

 

 

Message 3 of 9
(3,849 Views)

Hi goose,

 

I would do this in two steps:

1) use "spreadsheet string to array" with "#LSCRIPT:" as delimiter to produce a 1D array of strings

2) split each string at the "," to separate filename and size(?)

2b) check for errors as the last string will not deliver correct results...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 9
(3,845 Views)
0 Kudos
Message 5 of 9
(3,826 Views)

Thanks for all the great replies!

 

Is it possible to use 1 search string, which searches for filenames ending in both .pyo and py ?

 

Cheers

Goose

0 Kudos
Message 6 of 9
(3,809 Views)
Do you want them seperated or in the same list?
Tim
GHSP
0 Kudos
Message 7 of 9
(3,805 Views)
same list
0 Kudos
Message 8 of 9
(3,799 Views)
Solution
Accepted by morngoose
Try this
Tim
GHSP
Message 9 of 9
(3,793 Views)