CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2002
    Posts
    114

    Perl Reg Exp Problems

    How do I get the numbers from a string if they are between a the beginning of the line, a comma, or a space, and a space, a comma, or the end of the line? For Example:
    12, 3, "asdfasdfasd",0
    "asdfasd", 23,3, 10, "023", 0

    It should match the 12, 3, and 0 in the first line and the 23, 3, 10, and 0 in the second line.

    I tried:
    $line =~ /[^,\s](\d+)[$,\s]/g;

    It didn't match anything.

  2. #2
    Join Date
    Jun 2002
    Posts
    114

    Re: Perl Reg Exp Problems

    Nevermind, I am an idiot and used the class [] instead of ().

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured