Hello Makers, I cannot wrap my head around the usage of REGEX.
Here are five input examples, I bolded what I would like extract:
VTOAL232, remaining part of invoice
ZAGOR2303-JS John Smith
ACTDA2302/balance due
Deposit for booking reference ALPDA231
Invoice: ALPDA2309-MO
The pattern I’m trying to extract is positioned anywhere in the string and consists of 5 letters followed by 3 OR 4 numbers, potentially with a dash and 2 more letters as an optional extension. Any advise is welcome.
ChatGPT is usually good at creating Regex patterns.
But it does sometimes get them wrong, so it’s often best to validate them using the Regex checker and debugger at https://regex101.com/ (be sure to select ECMAScript in the left-hand menu).
I have generalized the regex to get anything between pipe and comma, not sure if that is what you desired for.
|([^,]+)
What this does is it will grab anything in between a pipe and comma, Let me know if it is what you want, we can also incorporate the 2023-06-25-Vila 60-Host for better result, but I am not sure how it looks for other results beside the one you shared.