Friday, September 19, 2014

Convert a property like file to a HashMap For Java with Regex in Python

I have a huge list of property like file. Now I need to convert this property like file to a HashMap in Java. Let's say my HashMap variable name is myHashMap. Recently I was playing with RegEx and Python. So I thought why not try to combine RegEx with Python to do this job! So, here's my solution.
NB: I've trimmed the property key and value.



To get the detail of the pattern go to RegEx101 and paste the below expression inside regular expression section.











AUTHOR:OBSCURE

No comments:

Post a Comment