regex - Extracting words between two expressions -
i want extract name between account number , amount while parsing stream of transactions here sample transactions:
18-05 12.34.56.789 mahmouud adam 100,00 123 18-05-2014 (18-05) alexandria
i have tried following returns null
(?<=\d{2}\.\d{2}\.\d{2}\.\d{3})(\w)+(?=\d+,\d+)
i.e. behind account number || {one or more words} || ahead amount
any idea?
\w
equals [a-za-z0-9_]
- not match spaces. match numbers, if use
(?<=\d{2}\.\d{2}\.\d{2}\.\d{3})([\w ]+)(?=\d+,\d+)
it willl match mahmouud adam 10
. (only 1 0 taken ahead).
try one:
(?<=\d{2}\.\d{2}\.\d{2}\.\d{3} )([a-za-z ]+)(?= \d+,\d+)
(i added match spaces before , after name look-arounds not included in match).
Comments
Post a Comment