Regex to match only the first line?

That's sounds more like a job for the filehandle buffer.

That's sounds more like a job for the filehandle buffer. You should be able to match the first line with: /^(.*)$/m (as always, this is PCRE syntax) the /m modifier makes ^ and $ match embedded newlines. Since there's no /g modifier, it will just process the firs occurrence, which is the first line, and then stop.

If you're using a shell, use: head -n1 file or as a filter: commandmakingoutput | head -n1 Please clarify your question, in case this is not wat you're looking for.

Yes, you can. Example in javascript: "This is the first line. \n This is the second line.".

Match(/^. *$/m)0; Returns "This is the first line." EDIT Explain regex: match(/^.

*$/m)0 ^: begin of line . *: any char (.), 0 or more times (*) $: end of line. M: multiline mode (. acts like a \n too) 0: get first position of array of results.

I don't believe this is what he's looking for... – polemon Sep 11 '10 at 2:25 @polemon: yes, you're right...I changed my answer. – Topera Sep 11 '10 at 2:27.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions