RE: Re: IS_NUMERIC ?. .

RE: Re: IS_NUMERIC ?. .

am 29.11.2005 21:06:16 von Martin.Norland

> -----Original Message-----
> From: El Bekko [mailto:elbekko@gmail.com]=20
>=20
> http://php.belnet.be/manual/en/function.is-numeric.php
>=20
> Apparently there is :)
>=20
>=20
> Dwight Altman wrote:
> > Hello List,
> > Is there an IS_NUMERIC(aCandidateString) function in MySQL that I
can run in
> > a query, similar to the various PHP "is_*" functions? I can't seem
to find
> > it in the docs (other than a C API IS_NUM macro).
> >=20
> > I have a field in a database with serial numbers like:
> > ...1234
> > ...1235
> > ...1236-A
> > ...1237B
> > and I want to get the last 4 characters of the numeric substring
like so:
[snip]

Last I checked, MySQL doesn't support PHP functions natively :)

His question was whether there's an equivalent function to that in
MySQL, and I agree with a previous answer, you can use a REGEXP (
http://dev.mysql.com/doc/refman/4.1/en/regexp.html ) if there is nothing
else available.

(example - randomly scrounged together)
REGEXP '^.*[:digit:]{4}.[^:digit:]*$' ( {1,4} if you want the last
group of up to 4 digits)

cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: Re: IS_NUMERIC ? [SOLVED]

am 29.11.2005 22:17:29 von Dwight Altman

Thanks folks.

Thanks Bastien.

-----Original Message-----
From: Norland, Martin [mailto:Martin.Norland@STJUDE.ORG]
Sent: Tuesday, November 29, 2005 2:06 PM
To: php-db@lists.php.net
Subject: RE: [PHP-DB] Re: IS_NUMERIC ?. .


> -----Original Message-----
> From: El Bekko [mailto:elbekko@gmail.com]
>
> http://php.belnet.be/manual/en/function.is-numeric.php
>
> Apparently there is :)
>
>
> Dwight Altman wrote:
> > Hello List,
> > Is there an IS_NUMERIC(aCandidateString) function in MySQL that I
can run in
> > a query, similar to the various PHP "is_*" functions? I can't seem
to find
> > it in the docs (other than a C API IS_NUM macro).
> >
> > I have a field in a database with serial numbers like:
> > ...1234
> > ...1235
> > ...1236-A
> > ...1237B
> > and I want to get the last 4 characters of the numeric substring
like so:
[snip]

Last I checked, MySQL doesn't support PHP functions natively :)

His question was whether there's an equivalent function to that in
MySQL, and I agree with a previous answer, you can use a REGEXP (
http://dev.mysql.com/doc/refman/4.1/en/regexp.html ) if there is nothing
else available.

(example - randomly scrounged together)
REGEXP '^.*[:digit:]{4}.[^:digit:]*$' ( {1,4} if you want the last
group of up to 4 digits)

cheers,
- Martin Norland, Sys Admin / Database / Web Developer, International
Outreach x3257

The opinion(s) contained within this email do not necessarily represent
those of St. Jude Children's Research Hospital.

--

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php