my first question, so bear with me should anything no quite right. (I have read all topics suggested after entering title, but still no luck)
In words I need to capture all (i.e. one or more) 6-digits numbers following after specific keyword (here: "Customer\s"), which begins with 14 or 15
Input string:
Part Numbe
Customer PO
Description
Cust Part No: 325386
EB011036 // 175663/147667/8 ECK
5500003766 / 148266 -
WALK
between the start keyword to look after, and the following suitable 6 digit pattern any signs can be placed.
What I have come up so far: Since the string can contain return, new lines etc. I set the (?s) flag before:
Then a positive lookbehind:
(?s)(?<=Customer )
followed by
.+?
and then
(\D(1(4|5)\d{4})\D)+
So the whole expression:
(?<=Customer ).*?(\D(1(4|5)\d{4})\D)+
https://regex101.com/r/FEKwcY/1
But this only finds the first instance (147667) after Customer, not the second or more following. If I change the wildcard between the groups to gready, it will find the last one, but not the first possible one.
Having played around further I added an alternation in the pos. lookbehind group:
(?s)(?<=Customer |\D\d{6}\D).*?(\D(1(4|5)\d{4})\D)+
This in fact find the two, but I am afraid, that this will also find before the Customer keyword.