Reputation: 3
I have this text:
OLD >> AAAAAA AA-BB dssd sdg Ad sdg ds Adsd gs AAA sdg dsg GGGGGG GG sdgds AAAA GF-S sdg . sdg. - 4353 ds gsd sdg GDS GDG 343 33 sdgsg sdgs DGSAGG DSDG S DG
new text
AAAAAA AA-BB dssd sdg Ad sdg ds Adsd gs AAA sdg dsg GGGGGG GG sdgds AAAA GF-S sdg . Asdg. AA sdg dsg - 4353 ds gsd sdg GDS GDG 343 33 sdgsg sdgs DGSAGG DSDG S DG And I want to extract the last occurrence of an uppercase string like
([A-Z -]+){5,100}
before a number:4353
So in this case the results should be:
AAAA GF-S
I tried /([A-Z -.]+){5,100} (.+) 4353/i
but it gets me the first.
Thanks for the fast answers, I made a modification in the search text. It should be last expresion that has only upper cases and it length bigger than 5
Upvotes: 0
Views: 69
Reputation: 786091
You can use this regex:
([A-Z][A-Z .-]{5,100})(?= [a-z .-]*4353)
Upvotes: 1