Hello,
I have a string that can take the following forms:
- MHF1234567HF1234
- HF1234MHF1234567
- MHF1234657
- HF1324
and I would like to retrieve the values of MHF (1324567) which is necessarily on 7 digits and HF (1234) which is necessarily on 4 digits. I can deal with substring, indexOf, but I wanted to know if I could not do better with regex. I would use the MHF regex [0-9] (7) and HF [0-9] (4) to get the channels MHF1234657 HF1324 and then values (assuming that the regex are good).I looked StringTokenizer, Pettern, but it not match Matcher. Any idea on this? If you know how to do this then please let me know. Thanks in advance.
Bookmarks