I'm currently using a scanning software "Drivve Image" to extract certain information from each paper. This software enables certain Regex code to be run if needed. It seems to be run with the UltraEdit Regex Engine.
I get the following scanned result:
1. 21Sid1
2. Ordernr
3. E17222
4. By
5. Seller
I need to search the string for the text Ordernr
and then pick the following line E17222
which in the end will be said filename of the scanned document. I will never know the exact position of these two values in the string. That is why I need to focus on Ordernr
because the text I need will always follow as the next line.
My requirements are such that I need the E17222
to be the only thing in the match result for this to work. I am only allowed to type plain regular expressions.
There is a great thread already: Regex to get the words after matching string
I've tested " \bOrdernr\s+\K\S+ "which works great..
Had it not been that the software don't allow for /K to be used. Are there any other ways of implementing \K?
Continuation
Though If the sample text involves a character behind "Ordernr" the current answer doesn't work to the extent I need. Like this sample:
21Sid1
Ordernr 1
E17222
By
Seller
The current solution picks up "1" and not the "next line" which would be "E17222". in the matched group. Needed to point that out for further involvement on the issue.
(?<=\bOrdernr\r\n)\S+
(adjust the linebreak to\r
or\n
if necessary). – Afloat(?<=\bOrdernr[\r\n]+)\S+
. However, ClasG's suggestion sounds correct to me. – Afloat