If you just want the first digit in the string:

digit = rereplace(string, '[^0-9]+([0-9]).*', '\1')

If you want the first number (i.e. 7 or 63)

digit = rereplace(string, '[^0-9]+([0-9]+).*', '\1')

As always, the plug for CF-RegEx:
http://www.houseoffusion.com/cf_lists/index.cfm?forumid=21


  --Ben Doom
    Programmer & General Lackey
    Moonbow Software

: -----Original Message-----
: From: Adrian Cesana [mailto:[EMAIL PROTECTED]]
: Sent: Wednesday, October 09, 2002 1:10 PM
: To: CF-Talk
: Subject: pulling 3 numerics from an alphanumeric string
:
:
: I need to pull the left most 3 numeric digits from an alphanumeric string,
: anyone have a good method of doing this?.  The string could also
: have other
: character in it like "#$,' etc...
:
: I was thinking this possibly could be done with LEFT() and REREPLACE()...
:
: Thanks,Adrian
:
: 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to