View Full Version : Reg Exp or otherwise?
10-15-2003, 03:20 PM
What is the best way to extract a single number from within a string? I think maybe a reg expression, but I am not real well versed in them.
10-15-2003, 03:31 PM
How is the number embedded in the string? What kind of number is it - may it contain decimal point, commas or spaces? Minus/plus?
Most likely, a regex is your best aproach, unless it's the first part of the string where parseInt/parseFloat would be better choices.
10-15-2003, 04:00 PM
The number would be a positive integer somewhere within the string. You are right about the regex. I'll research it and see if I can learn to use it properly.
Thanks for your help.
10-15-2003, 04:08 PM
10-15-2003, 04:49 PM
Perfect perfect perfect. I just love this forum!
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.