Each entry has a "|" separating them. What I'm looking to do is just extract from the list the ones that meet my need. For example, in the above string I want to capture any item that begins with the letter "C". Once captured, I want to put that information in a new string so my output would look like this:

Share this post

Link to post

Share on other sites

Uten 8

Uten 8

Each entry has a "|" separating them. What I'm looking to do is just extract from the list the ones that meet my need. For example, in the above string I want to capture any item that begins with the letter "C". Once captured, I want to put that information in a new string so my output would look like this:

I'm having to go through and sort a list that is 15,000 items long. The above example is one of many things I have to sort, so I need to make it so it can be easily changed to the criteria I need.

I'm not sure on how to search for this, for as you can see, my question is very word intensive. I'm assuming this is just a couple lines of code. I'm just not sure how to do it. Thoughts?

From the help file:

StringRegExp ( "test", "pattern" [, flag ] )
Flag Values:
0 Return true/false (1/0) as to whether the test matched the pattern.
1 Return an array with the text that matched all the group patterns. Check @Extended to determine whether the pattern matched or not.
2 Same as 0.
3 Perform a global search, checking the entire string, returning an array of all results. Check @Extended to determine whether the pattern matched or not.

vollyman, you just need to make sure that your data file/string contains the | character as the first and last characters like vollyman's otherwise you could miss the first and last possible data matches.

Be open minded but not gullible.A hammer sees everything as a nail ... so don't be A tool ... be many tools.

Share this post

Link to post

Share on other sites

Bert 1,272

Bert 1,272

Some background. I have a program that reads the string and puts it into a list. The string must be in this format for the program to read it: item1|item2|item3

What I'm attempting is to design a update script that pulls data from a 15,000+ item excel spreadsheet and transforms it to the string format I need. I can do this part and put the data into a string, but I need to pull out sections depending on what the items are, such as all compaq items. when I pull the items, I need to create a string with just those items, and in the same format. If you look in my first post, you will see what I mean. I really need to solve this problem with working code.

Some background. I have a program that reads the string and puts it into a list. The string must be in this format for the program to read it: item1|item2|item3

What I'm attempting is to design a update script that pulls data from a 15,000+ item excel spreadsheet and transforms it to the string format I need. I can do this part and put the data into a string, but I need to pull out sections depending on what the items are, such as all compaq items. when I pull the items, I need to create a string with just those items, and in the same format. If you look in my first post, you will see what I mean. I really need to solve this problem with working code.

Obviously your out of imagination at the moment @vollyman. You hava a solution solving what you want, you just have to tweek it a bit. But it is not good enough for you since it does not give you the entier solution.

Even thought I'm abit pissed by that kind of atitude (you probably have a good exuse, and I probably have it my selfe from time to time, and you did modify your post to the better). So I wil give you the solution:

Share this post

Link to post

Share on other sites

Bert 1,272

Bert 1,272

I tried the script, and decided to try it with a different string to see what would happen. I had the script connect to the script that would put out the string I need to pull data from. I wanted to capture every application we list in the sheet. In the "C" section, we list about 50 applications. When I run it against the script you gave me, it kicked out only 17. hmmmm.... This search string thing is quite tricky to do.