|laziness, impatience, and hubris|
Regexp and reading a file n-lines at timeby epimenidecretese (Acolyte)
|on Feb 01, 2010 at 10:43 UTC||Need Help??|
epimenidecretese has asked for the wisdom of the Perl Monks concerning the following question:
I'm working on a cook book in .txt format and I'd like to tag in xml the title,the ingredients and the procedure of each recipe.
The text look like this:
1-I've tried to put all the file in one string and then apply the regex to it,but if the words matches,then I got printed all the text,and not just my line.
2-If instead I try to read the file line by line I can't search something like /[0-9]\. .*\n\n/ because I can't catch more than one \n.
3-Then I tried to create an array in this way
but then I don't know how to handle it(I'm a perl beginner and this is my first post).
Here is my last attempt.All the \n are doubled so I've changed them with a single \n.
So,I just want to catch(and print just what I've matched!) some text between more than one \n.
Thanks in advance,and sorry for my english.