retrieve text from file name

I have a need to retrieve text from a file name. I have a folder with 100 files. Each file name is like this:

123_foldername-chevy.wav
124_foldername-ford.wav
125_foldername-vovlo.wav
126_foldername-mercedes.wav

all I need is: chevy, ford, volvo, mercedes

have an Applescript that gives me what I need but was hoping XOJO can give me the same thing. Any ideas. I have no idea where to begin.

RegEx()
NthField/CountFields()
Mid()

?

thanks, I don’t know what any of those 3 lines does. Not a lazy person but don’t know where to get the needed info. Will the help screen give me examples of how to use Mid(). Thanks for any help.

Look in Help > Language Reference for specific help.

i would use replace to remove the .wav extension

dim str as string
dim vMinus as string
str=“123_foldername-chevy.wav”
str=replace(str,".wav","") ’ remove ‘.wav’
vMinus=instr(1,str,"-")
str=MID(str,vMinus+1, 99) ’ looking for the ‘-’ and start from the next character to the end of the str

how would i use regex to get what shawn want??

[code]dim rx as new RegEx
rx.SearchPattern = “(?mi-Us)-(\w+)”

dim rxOptions as RegExOptions = rx.Options
rxOptions.LineEndType = 4

dim match as RegExMatch = rx.Search( sourceText )
[/code]

i would love to learn more about regex… seem like regex can do lots of things…

I use Autohotkey at work on my PC.
I use the Loop function to loop through the folder. If a file has “-”, then get the text AFTER the - and BEFORE .wav
how do you loop through a folder and process every file, looking for a - in the file name and then get the text.

Use a for next loop;
in that loop, get the file name (FolderItem.Name),
InStr(FolderItem.Name,"-")

In fact, make a search in the docs on the above keywords.

Remember: different IDEs (Developement evironments) / nearly same command names.

Also: there are a bunch of documents to read (Tutorial, QuickStart, etc.) in the Xojo folder (check in Documentation) and there: http://documentation.xojo.com/ that allow you to understand how to achive your goals.