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

regular expressions in rindex function

Thread Next
Richard Pfeiffer
March 18, 2002 12:00
regular expressions in rindex function
Message ID:
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]/); either I'm doing it wrong or I can't use a
regular expression within rindex.  (My vote goes
for the former!)


Do You Yahoo!?
Yahoo! Sports - live college hoops coverage

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About