Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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,}" Regards Claus B. -- Windows10 Microsoft 365 for business |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Cool! That pattern works!
But how do you test when no matches are found? I think it's returning the last element of the array when I search for a letter not in the array, such as "x". |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I mean, there's an error message if I search for a missing letter in the array.
How do you test for an empty array? I thought "IsEmpty()" would work? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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: The code works great! Ignore my previous post about testing for an empty array. I merely need to check the count of the variable n to determine the array size. Thanks Claus! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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." |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Am Sat, 6 Feb 2021 23:06:11 -0800 (PST) schrieb Tatsujin: 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." RegExp is for searching words or substrings in a text but not for searching sentences. Regards Claus B. -- Windows10 Microsoft 365 for business |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 2/8/2021 10:46 AM, Claus Busch wrote:
Hi, Am Sat, 6 Feb 2021 23:06:11 -0800 (PST) schrieb Tatsujin: 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." RegExp is for searching words or substrings in a text but not for searching sentences. For limited definitions of what constitutes a sentence it can be done. One stackoverflow submission of many. <https://stackoverflow.com/questions/5553410/regular-expression-match-a-sentence -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to extract data from an array | Excel Programming | |||
Extract multiple values from array | Excel Discussion (Misc queries) | |||
Extract a column/row from a 2-D array | Excel Programming | |||
How do I extract a single value from the linest array result? | Excel Worksheet Functions | |||
How do I extract hyperlink as text from an array of hyperlinks? | Excel Worksheet Functions |