09-23-2009 06:18 AM
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
Solved! Go to Solution.
09-23-2009 06:24 AM
Can you post what you have did so far, that will help to support further.
Mathan
09-23-2009 06:41 AM
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.
09-23-2009 06:45 AM
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...
09-23-2009 07:35 AM
09-23-2009 08:17 AM
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
09-23-2009 08:24 AM
09-23-2009 08:30 AM
09-23-2009 08:48 AM