Re: Help on string manip

2008-08-13 Thread Dr.Ruud
"DeeDee Messersmith" schreef: > I have strings such as the following: > > .INSERT,SCREW THREAD.. > > I need the leading dots but not the trailing. As you see it has > commas and spaces in it so the traditional \w doesn't work. the .* > doesn't work as it picks up the trailing dots. T

Re: Help on string manip

2008-08-11 Thread anexpert
On Mon, Aug 11, 2008 at 5:02 PM, DeeDee Messersmith <[EMAIL PROTECTED]> wrote: > I have strings such as the following: > > .INSERT,SCREW THREAD.. > > I need the leading dots but not the trailing. As you see it has commas and > spaces in it so the traditional \w doesn't work. the .* doe

Re: Help on string manip

2008-08-11 Thread yitzle
On Mon, Aug 11, 2008 at 5:02 PM, DeeDee Messersmith <[EMAIL PROTECTED]> wrote: > I have strings such as the following: > > .INSERT,SCREW THREAD.. > > I need the leading dots but not the trailing. As you see it has commas and > spaces in it so the traditional \w doesn't work. the .* doe

Help on string manip

2008-08-11 Thread DeeDee Messersmith
I have strings such as the following: .INSERT,SCREW THREAD.. I need the leading dots but not the trailing. As you see it has commas and spaces in it so the traditional \w doesn't work. the .* doesn't work as it picks up the trailing dots. The result I want back is: .INSERT,SCREW TH

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 t

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-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

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/

Re: string manip

2007-04-19 Thread Rob Dixon
Tom Phoenix wrote: On 4/18/07, Nishi <[EMAIL PROTECTED]> wrote: I have a string of the form $ARGV[0]="abc/def/ghi"; I need to strip abc to convert $ARGV[0] to $ARGV[0]="def/ghi" Please let me know how I can achieve it. Maybe you want one of these? $ARGV[0] = "def/ghi" if $ARGV[0] eq "a

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-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 $lan

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 followi

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: string manip

2007-04-18 Thread Tom Phoenix
On 4/18/07, Nishi <[EMAIL PROTECTED]> wrote: I have a string of the form $ARGV[0]="abc/def/ghi"; I need to strip abc to convert $ARGV[0] to $ARGV[0]="def/ghi" Please let me know how I can achieve it. Maybe you want one of these? $ARGV[0] = "def/ghi" if $ARGV[0] eq "abc/def/ghi"; $ARGV

Re: string manip

2007-04-18 Thread Jason Roth
There are lots of ways you could accomplish this, my choice would be something like $ARGV[0] =~ s#^[^/]+/##; -Jason On 4/18/07, Nishi <[EMAIL PROTECTED]> wrote: Hi: I have a string of the form $ARGV[0]="abc/def/ghi"; I need to strip abc to convert $ARGV[0] to $ARGV[0]="def/ghi" Please let m

string manip

2007-04-18 Thread Nishi
Hi: I have a string of the form $ARGV[0]="abc/def/ghi"; I need to strip abc to convert $ARGV[0] to $ARGV[0]="def/ghi" Please let me know how I can achieve it. Thanks!

Re: string manip.

2007-02-21 Thread John W. Krahn
Nishi Bhonsle wrote: > > On 2/16/07, John W. Krahn <[EMAIL PROTECTED]> wrote: >> Nishi Bhonsle wrote: >> >> > I have a string such as >> > instance/bit/bitGroup/default/tz/l_cs >> > where the last directory stands for os languages. >> > >> > I have to get the last directory and assign it to a var

Re: string manip.

2007-02-21 Thread Nishi Bhonsle
Hi: In case the string i am looking for is secondlast position as in instance/bit/bitGroup/default/tz/l_cs/messages How can i change the manip code to get l_cs in this case? Thanks! On 2/16/07, John W. Krahn <[EMAIL PROTECTED]> wrote: Nishi Bhonsle wrote: > Hi: Hello, > I have a string su

Re: string manip.

2007-02-16 Thread John W. Krahn
Nishi Bhonsle wrote: > Hi: Hello, > I have a string such as > instance/bit/bitGroup/default/tz/l_cs > where the last directory stands for os languages. > > I have to get the last directory and assign it to a var such as > $mylang = l_cs, in the above example. > How can i achieve that? $ perl -l

Re: string manip.

2007-02-16 Thread Dr.Ruud
"Nishi Bhonsle" schreef: > I have a string such as > instance/bit/bitGroup/default/tz/l_cs > where the last directory stands for os languages. > > I have to get the last directory and assign it to a var such as > $mylang = l_cs, in the above example. > How can i achieve that? my $s = q{instan

Re: string manip.

2007-02-16 Thread Jeff Pang
> >I have a string such as >instance/bit/bitGroup/default/tz/l_cs >where the last directory stands for os languages. > >I have to get the last directory and assign it to a var such as >$mylang = l_cs, in the above example. >How can i achieve that? > Hello, Here is one way to do it: my ($mylang)

Re: string manip. @ 1171669455

2007-02-16 Thread Johan Meskens CS3 jmcs3
Intrah onat Diria .. Fri, 16 Feb 2007 15:08:02 -0800 , "Nishi Bhonsle" wrote "Revera y": > Thanks. > > How can i achieve that? my $s = 'instance/bit/bitGroup/default/tz/l_cs'; $s =~ /.*\/(.*)$/; print $1; > $mylang = l_cs, in the above example. > I have to get the last directory and

string manip.

2007-02-16 Thread Nishi Bhonsle
Hi: I have a string such as instance/bit/bitGroup/default/tz/l_cs where the last directory stands for os languages. I have to get the last directory and assign it to a var such as $mylang = l_cs, in the above example. How can i achieve that? Thanks. -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: string manip on japansese characters?

2002-04-15 Thread Felix Geerinckx
on Mon, 15 Apr 2002 16:36:44 GMT, John Mooney wrote: > I was wondering if someone could provide some advice on how to tweak > a perl script to deal with double-byte (UTF_8 & S-JIS) characters > from within perl Are you familiar with the 'Perl, Unicode and i18N FAQ' at

string manip on japansese characters?

2002-04-15 Thread John Mooney
Hello, I was wondering if someone could provide some advice on how to tweak a perl script to deal with double-byte (UTF_8 & S-JIS) characters from within perl. I've read a TPJ article by Jeff Friedl. I've also searched CPAN and found many different modules - IMAP*, UTF-*, and on and on and am a