in reply to regex is not working properly
Don't use greedy matching '.*', use non-greedy instead '.*?'
Also, I would suggest that you learn how to use an actual HTML Parser instead of jury rigging regex's.