Seperate numbers from text

Ken Ray kray at
Tue Apr 5 22:51:09 CDT 2005

On 4/5/05 9:55 PM, "Dwayne Rothe" <drothe at> wrote:

> Is there a way to seperate numbers from text in a string?
> e.g "string69" to return 69 or "string69also" to return 69
> Is it possible to filter somehow?

Well, if you only have one number in the string (i.e. not something like
"one45two50three60"), you can use this:

function GetNum pWhat
  local tNum
  get matchText(pWhat,"([0-9]+)",tNum)
  return tNum
end GetNum


Ken Ray
Sons of Thunder Software
Web site:
Email: kray at

More information about the use-livecode mailing list