develooper Front page | perl.beginners | Postings from March 2002

regular expressions in rindex function

Thread Next
From:
Richard Pfeiffer
Date:
March 18, 2002 12:00
Subject:
regular expressions in rindex function
Message ID:
20020318195558.13245.qmail@web10803.mail.yahoo.com
Good Afternoon,

Wondering if anyone could help me with this or
enlighten me on another way to go about it.

I have a string that has various white space
(tabs, spaces, etc) at the end of it.  I want to
find the last real char [0-9a-zA-Z] and then use
chop or chomp to remove the whitespace.

I've tried:
rindex($file, "t");  
which of course works if the last char is a 't',
but I certainly cannot always be assured of this.

However, none of the following word char
expressions are working:
rindex($file, "/[0-9a-zA-Z]/");
rindex($file, /[0-9a-zA-Z]/);
rindex($file, [0-9a-zA-Z]);
rindex($file, /[\w]/);
....so either I'm doing it wrong or I can't use a
regular expression within rindex.  (My vote goes
for the former!)

Thanks!
-R


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About