Re: reqular expr for string manip.

2007-04-20 Thread oryann9
Mumia W. schreef: my $lang = ($topdir =~ /([^\/]+)$/)[0]; ITYRMSL: my ($lang) = $topdir =~ m~([^/]+)$~; -- Dr Rudd, I have never seen the expression m~ or $~ Will you tell me what this is and what is says? thank you __ Do You

Re: reqular expr for string manip.

2007-04-20 Thread Rob Dixon
oryann9 wrote: Dr. Ruud wrote: Mumia W. schreef: my $lang = ($topdir =~ /([^\/]+)$/)[0]; ITYRMSL: my ($lang) = $topdir =~ m~([^/]+)$~; I have never seen the expression m~ or $~ Will you tell me what this is and what is says? Like all Perl quoted constructs, the pattern match can

Re: reqular expr for string manip.

2007-04-20 Thread Rob Dixon
Dr.Ruud wrote: Mumia W. schreef: my $lang = ($topdir =~ /([^\/]+)$/)[0]; ITYRMSL: my ($lang) = $topdir =~ m~([^/]+)$~; IDUWYM. CYETUP? Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: reqular expr for string manip.

2007-04-20 Thread Jeff Pang
my ($lang) = $topdir =~ m~([^/]+)$~; -- I have never seen the expression m~ or $~ Will you tell me what this is and what is says? m~foobar$~ is the same as, m/foobar$/ here m~ and $~ are not special operators or variables at all,just the board-symbol for regex.:)

Re: reqular expr for string manip.

2007-04-19 Thread Mumia W.
On 04/18/2007 10:26 PM, Nishi 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! my $lang = ($topdir =~

Re: reqular expr for string manip.

2007-04-19 Thread Dr.Ruud
Mumia W. schreef: my $lang = ($topdir =~ /([^\/]+)$/)[0]; ITYRMSL: my ($lang) = $topdir =~ m~([^/]+)$~; -- Affijn, Ruud Gewoon is een tijger. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

reqular expr for string manip.

2007-04-18 Thread Nishi
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!

Re: reqular expr for string manip.

2007-04-18 Thread yitzle
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 [EMAIL PROTECTED] wrote: Hi: I am using the following

Re: reqular expr for string manip.

2007-04-18 Thread Jeff Pang
For your purpose,using Perl's built-in module File::Basename is a good way. use File::Basename; my $filename = basename($topdir); my $dirname = dirname($topdir); Good luck! 2007/4/19, Nishi [EMAIL PROTECTED]: Hi: I am using the following reqular expression to extract the last part ie $lang