I am very new to coffee and regex, I am trying to do some string manipulation
I will have a string like this
x = '<div class="sample">
<img src="http://www.example.com/i/java.png">
</div>
<div class="sample_another">
<img src="/i/somedir/python.png" height="200px">
</div>'
Now I want to parse the the url of the img tag and get the height and width of image so the string after manipulation should look something like this. also This manipulation should not be done, if the image tag already has the height or width or both defined.
x = '<div class="sample">
<img src="http://www.example.com/i/java.png" height="200px" width="100px" >
</div>
<div class="sample_another">
<img src="/i/somedir/python.png" height="200px">
</div>'
Any help on how to achive this? thanks