View Full Version : regex capital letter only of a string
ggalan
11-09-2010, 05:30 PM
i saw that from a previous post, this works to filter out only the numbers
$string = "this is a STring123 test";
$numbers = preg_replace('/.*?(\d+).*/', '$1', $string);
echo $numbers;
but how can i modify that regex to filter out only the capital or lowercase ?
ggalan
11-09-2010, 05:58 PM
actually i found that this will out put the last 3 digits of a string
$str = "My string";
echo substr($str, -3);
anyone know how to get the first 2 digits?
ggalan
11-09-2010, 06:00 PM
nm
echo substr($str, 0, 2);
james438
11-10-2010, 12:10 PM
are you still needing help or did you find what you are looking for? from what I am reading I am not sure what exactly it is your script is being used for.
ggalan
11-16-2010, 03:32 AM
originally i wanted a script / regex to pull only the upper or lower case of a string
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.