I have a list of fruits that I loop each of it to check if it is found in a string. I would like to use regex to check if current keyword also has a prefix of “exclude” or “excluding” so I can bypass/skip it.
Example:
Possible formats:
input_string = Apple | Mango | All Fruits (exclude Orange) | Melon | Guava/Grapes | Excluding: Banana, Strawberry, Cherry | Avocado
Could you let us know if there would be any other variations of the data format ?
Currently we see two patterns with exclude and excluding also brackets are being used for exclude. Do we have any other such patterns ? Is it possible that it is irregular at times ?
We get the updated String where the excluding items are removed and is not present in the updated string, You should then be able to perform the comparison by checking if the item is present in the string.
Thanks @supermanPunch it is working in Studio but original code is using Invoke VBA to call a macro to check the keyword, looks like Positive Lookahead is not working in VBA macro.
Hi @supermanPunch, in my VBA code I’m iterating through a list of fruits, first loop is Orange but since it has a prefix exclude I need to skip it, I need to know which fruits I am skipping.
Is it possible for you to provide the VBA Code as well ? Wanted to check if we can make it easier, also want to know what are the values that are being passed to the VBA.
@supermanPunch , here’s the sample VBA code. I simplified it for better understanding. Basically I need to incorporate the fruit to the regex that I will be using.