June 6, 200817 yr I've looked and I can't find so please forgive if this has already been solved I want to extract the url containing the word (or part of word) contact from a list of urls. Here is an example of the raw list: [23] http://192.168.0.200/FEEDBACK.HTM[24] http://192.168.0.200/ADVERTISE.HTM[25] http://192.168.0.200/CONTACTS.HTM[26] I would like to have his returned: http://192.168.0.200/CONTACTS.HTM Any ideas would be appreciated (I've bashed my head against this for hours) Cheers Pete
June 6, 200817 yr It looks like you need a little creative use of the script step: Position ( text ; searchString ; start ; occurrence ). e.g. You could run a loop that finds words beginning with "http:" and loads them into a repeating field, then you would have all the addresses in the repeating field and it would leave out any other extraneous rubbish. If the addresses come with the "[XX]" tacked on the end, you might also want to remove this as a step in the loop too. Anatole
June 6, 200817 yr It doesn't seem too difficult, but some points require clarification: extract the url containing the word (or part of word) contact 1. What does "part of word" mean? Do words like "control" or "intact" contain part of the word "contact"? 2. Could there be more than one URL that needs to be extracted? 3. Does the number in brackets come after the URL or before it?
June 6, 200817 yr Author I need the full word contact. I've built a workaround for now which does the job Make each url into a separate line by substituting the [ character for the newline character. Using the custom function ExtractLine inside a script loop to pull each line and check it for "contact" It's clumsy but it works for now. Can't spend all day solving one problem. I'd like to come back to it as I hate messy code. Thanks Pete
June 6, 200817 yr I need the full word contact. Well, that answers #1, and I guess from the rest that the answer to #2 is yes - but what about #3?
June 6, 200817 yr Author Sorry, I'm the idiot. The number in brackets comes before the url. Thanks Pete
June 6, 200817 yr Try a custom function: ExtractContacts ( text ) Let ( [ pos = Position ( text ; "contact" ; 1 ; 1 ) ; start = Position ( text ; "] " ; pos ; -1 ) + 2 ; end = Position ( text & "[" ; "[" ; pos ; 1 ) ] ; Case ( pos ; Middle ( text ; start ; end - start ) & ¶ & ExtractContacts ( Right ( text ; Length ( text ) - end ) ) ) )
Create an account or sign in to comment