Re: finding the first non digit character in a string
- From: a.r.ferreira@xxxxxxxxx (Adriano Ferreira)
- Date: Fri, 28 Oct 2005 11:50:54 -0200
On 10/28/05, Bowen, Bruce <Bowenb@xxxxxxxxxxx> wrote:
> The data may look like this:
> $DD = "5000|SIHHTEXT"
> I've tried $d = index($DD, m/[^\d]/);
> $d = index($DD, /[^\d]/);
> $d = index($DD, [^\d]);
C<index> doesn't work with regexes. But you can use C<pos>
$ perl -e '$DD = "5000|SIHHTEXT"; print pos($DD) if $DD =~ /\D/g'
5
Read about this usage at C<perldoc -f pos>.
Adriano.
.
- References:
- finding the first non digit character in a string
- From: Bruce Bowen
- finding the first non digit character in a string
- Prev by Date: Re: help slurping a file-- Solved -- Thanks for responses
- Next by Date: Re: finding the first non digit character in a string
- Previous by thread: finding the first non digit character in a string
- Next by thread: Re: finding the first non digit character in a string
- Index(es):
Relevant Pages
|