in reply to complicated expression

Is it possible for the password to contain whitespace?

Replies are listed 'Best First'.
Re: Re: complicated expression
by Anonymous Monk on Apr 03, 2002 at 01:09 UTC
    this is p3rldud3 again.

    thanks gav,i took your approach, looks good, but it doesnt work correctly for me!

    lets get back to some another example input line.

    211.46.248.1 /the / directory / is / here/ l:user p:pass port:21

    the $path can be long and also have several whitespaces in it. at the first expression, i used a expression to get the path starting at the first "/" and the last "/".

    then it should work fine!

    would you help me inserting this fix in your code? many thanks!

    perldude
      my $foo = "211.46.248.1 /the / directory / is / here/ l:user p:pass po +rt:21"; my @bar = $foo =~ /^(\d+\.\d+\.\d+\.\d+) +(.+)(?= l:) +l:(\S+) p:(\S+) + port:(\d+)/; print join ',', @bar; # prints 211.46.248.1,/the / directory / is / here/,user,pass,21

      You may want to qr// the RegEx if you plan to use it inside of a loop while parsing your file.

      --perlplexer
        Very Great! Many thanks to YOU and the other who were helping!
        Greets, Perldude