RE: Re: IS_NUMERIC ? [SOLVED]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks folks.

Thanks Bastien.

-----Original Message-----
From: Norland, Martin [mailto:Martin.Norland@xxxxxxxxxx]
Sent: Tuesday, November 29, 2005 2:06 PM
To: php-db@xxxxxxxxxxxxx
Subject: RE:  Re: IS_NUMERIC ?. .


> -----Original Message-----
> From: El Bekko [mailto:elbekko@xxxxxxxxx] 
> 
> 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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux