in reply to String contents

Maybe there is a bigger problem you are trying to solve than just "print a string"? If so perhaps you should express it so we can help with the real issue rather than everyone being frustrated because the obvious answer to the question you asked has no relevance to the solution you are looking for?

True laziness is hard work

Replies are listed 'Best First'.
Re^2: String contents
by perlyr (Novice) on Jun 29, 2012 at 08:21 UTC
    Yes, I was trying to extract a string from a textfile, but couldn't parse it correctly. Here is part of the file:
    ended June 30, 2001 in conformity with accounting principles generall +y accepted in the United States of America. Also in our opinion, the related fina +ncial statement schedule, when considered in relation to the basic consolida +ted financial statements taken as a whole, presents fairly, in all materia +l respects, the information set forth therein. Melville, New York /s/KPMG LLP September 26, 2001
    Here is my regex:
    /^\s*(\w+),\s*(\w+ \w+)(.+?\s*LLP)$/m;

    I wanted to extract: Melville, New York, /s/KPMG LLP

    Any suggestions?

      Any suggestions?

      Yes. Take note of my sig. I'm not going to work hard to decode your node because you are too lazy to read the instructions about using a little mark up so that your node is nicely formatted.

      If you had expended just a little time and effort (maybe five minutes) to explain your problem well and formatted your node nicely you'd have had an answer in 15 minutes and be an hour ahead.

      True laziness is hard work
        you are right, the anchor $ shouldn't be there. But I only extracted "New" instead of "New York"
        Here is the code again:
        /^\s*(\w+),\s*(\w+ \w+)(.+?\s*LLP)/m
        why did I extract "New" instead of "New York"?

      Melville, New York /s/KPMG LLP

      September 26, 2001