I have two paragraphs in a buffer which has only simple text in it:
PARAGRAPH 1
PARAGRAPH 2
I need to read from the first char of the first character of each paragraph until it’s last word and store in an Array. This should be done for each paragraph. How Can I identify paragraphs if there are no extra markup tags?
If this is not possible, if I ask user to press enter twice after each paragraph how can I again split my text by identifying these? I tried regex but it doesn’t work.
Here’s one way to do it:
split-string is an easy way to divide up text based on a regular expression to split on.
To convert the list of results to an array I use the function ‘vector’ which makes an array the parameters passed to it. In order to pass the contents of the list to that function instead of the list itself, I use ‘apply’.