Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: regex problem (again)

by JavaFan (Canon)
on Apr 30, 2012 at 06:22 UTC ( [id://968003]=note: print w/replies, xml ) Need Help??


in reply to regex problem (again)

Use /\S{4}\s(.+)/. I don't understand the (?{length($input);}) part -- it will always true unless $input is the empty string.

BTW, the regexp as given did not match, so $txt did not start with a space.

Replies are listed 'Best First'.
Re^2: regex problem (again)
by uday_sagar (Scribe) on Apr 30, 2012 at 06:45 UTC
    Hi sweepy, Just replace S (upper case) with s (lower case)
    $input = "xxxx aaaa bbbbb"; ($txt) = $input =~ /\s{5}(.+)(?{length($input);})/; chomp; print $txt;
    This is working!
      No, it's not:
      my $input = "xxxx aaaa bbbbb"; my ($txt) = $input =~ /\s{5}(.+)(?{length($input);})/; print $txt, "\n"; __END__ Use of uninitialized value $txt in print at ?? line ??.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://968003]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-19 10:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found