Okay, I'm playing with some JavaScript regular expressions as a bit of practice and I've set myself the task of turning this text file into a json object:
Text file:
title: #HEY
image: http://localhost:4089/assets/images/backgrounds/bg.jpg
date: 2013-03-19 13:48:30
excerpt: The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men.
body:
The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother\'s keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance upon thee.
Normally, both your ***** would be dead as ****** fried chicken, but you happen to pull this **** while I'm in a transitional period so I don\'t wanna kill you, I wanna help you. But I can\'t give you this case, it don\'t belong to me. Besides, I\'ve already been through too much **** this morning over this case to hand it over to your dumb ***.
The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother\'s keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance upon thee.
into this:
{
title: '#HEY',
image: 'http://localhost:4089/assets/images/backgrounds/bg.jpg',
date: '2013-03-19 13:48:30',
excerpt: 'The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother\'s keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance upon thee.
Normally, both your ***** would be dead as ****** fried chicken, but you happen to pull this **** while I'm in a transitional period so I don\'t wanna kill you, I wanna help you. But I can\'t give you this case, it don\'t belong to me. Besides, I\'ve already been through too much **** this morning over this case to hand it over to your dumb ***.
The path of the righteous man is beset on all sides by the iniquities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother\'s keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy My brothers. And you will know My name is the Lord when I lay My vengeance upon thee. '
}
I figured regular expressions would be best for this (since it's a Node experiment) and currently I have this expression (which I'm sure can be greatly improved) but it has an issue with the body containing line breaks between paragraphs.
/^(.*)\: ?\n?(.*)/gim
How can I get it to select the whole body text instead of skipping the middle paragraph?
[edit]
To clarify, I'm not interested in the making json part, this isn't my question and not a problem, it's the regular expression that is the question.