I am trying to read a line and parse a value using regular expression in java. The line that contains the value looks something like this,
...... TESTYY912345 .......
...... TESTXX967890 ........
Basically, it contains 4 letters, then any two ASCII values followed by numeric 9 then (any) digits. And, i want to get the value, 912345 and 967890.
This is what I have so far in regular expression,
… TEST[\x00-\xff]{2}[9]{1} …
But, this skips the 9 and parse 12345 and 67890. (I want to include 9 as well).
Thanks for your help.
You are pretty close. Capture the entire group
(9\\d*)after matchingTEST\\p{ASCII}{2}. This way, you’ll capture the9and the following digits: