For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > April 2007 > Re: reqular expr for string manip.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: reqular expr for string manip.
Yitzle

2007-04-19, 3:58 am

What do you get?
Try:

my $topdir = "common/default/l_cs";

# Find the part of the string that does not have a slash and is
followed by end of line
$topdir =~ /([^\/]+)$/; # Or should that read /([^/]+)$/ ?

my $lang = $1;


On 4/18/07, Nishi <nishiprafull@gmail.com> wrote:
> Hi:
>
> I am using the following reqular expression to extract the last part ie
> $lang of the following string
> $topdir = "common/default/l_cs";
> my $lang=$topdir =~ /.*\/(.+)$/;
>
> But it doesnt seem to work, what am i missing here?
>
> Thanks!
>

Anerter6

2007-04-20, 10:48 pm

http://Mel-Gibson-spanking.info/Win...hp?movie=148803
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com