E.G. We have this sentence.
Sample 987 abc sample 567 xyz, yellow world sample 123
By using this regex = sample \d+
I would like, by using re.findall() to get values next to the sample which is after word abc, which is sample 567 and sample 123
I know how to find the value I need, the problem is that I need to use it AFTER a specific word and not sure how to.
P.S. This word can be changed from abc to word so the result will be sample 123 and e.t.c....
samplefromSamplethrough the capitalized "S". It looks like that word "abc" will only occur before anysamplewith a lower "s". Therefor\bsample (\d+)may work?re.findall(r'\bsample\s*(\d+)', s)? ideone.com/LL8wO9