View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Tatsujin Tatsujin is offline
external usenet poster
 
Posts: 25
Default Extract segments of an array

On Saturday, February 6, 2021 at 6:30:12 PM UTC-7, Claus Busch wrote:
Hi,
Am Sat, 6 Feb 2021 16:42:22 -0800 (PST) schrieb Tatsujin:

I changed the mysort() array to this:

mysort(1) = "apple"
mysort(2) = "apricot"
mysort(3) = "baby"
mysort(4) = "banana"
mysort(5) = "bar"
mysort(6) = "fit"

When I use the search pattern of "a", it sets myarray to this:
myarray = ["apple", "apricot", "aby", "anana"].

sorry, my bad.

to find the "a" at the beginning of the word you have to insert \bin
front of the pattern:
ptrn = "\ba[a-z]{1,}"


Hi Claus. Do you know how to modify that regex pattern so that it grabs the entire string after the first matched letter?

So, if mysort(1) = "Andy is in Room #29.", then myarray(0) should have "Andy is in Room #29."