Results 1 to 3 of 3

Thread: quick help

  1. #1
    Join Date
    Dec 2003
    Posts
    2

    Question Unanswered: quick help

    I have a text

    $text = '1sp2spsp3tab"john doe"';
    #sp == space, and tab == tab

    need to output
    $out[0] = 1
    $out[0] = 2
    $out[0] = 3
    $out[0] = "john doe";

    any help would be appreciated

  2. #2
    Join Date
    Dec 2003
    Posts
    2
    I meant;

    $text = '1sp2spsp3tab"john doe"';
    #sp == space, and tab == tab

    need to output
    $out[0] = 1
    $out[1] = 2
    $out[2] = 3
    $out[3] = "john doe";

  3. #3
    Join Date
    Dec 2003
    Location
    Haverhill, MA
    Posts
    4
    Originally posted by SeanAnk
    I meant;

    $text = '1sp2spsp3tab"john doe"';
    #sp == space, and tab == tab

    need to output
    $out[0] = 1
    $out[1] = 2
    $out[2] = 3
    $out[3] = "john doe";
    I'm not sure I understand what you need. Why does your $text string have double-quotes inside of the single-quotes?

    You could put together a regex that would look for a number, followed by a space, followed by a number, followed by two spaces, followed by a number, followed by a tab, and then followed by the rest. You shouldn't need to include the double-quotes.

    I'd be interested in seeing what you come up with for regex. If you need help in learning something about regex, a decent tutorial suitable for beginners can be found at http://www.english.uga.edu/humcomp/perl/regex2a.html

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •