Page 1 of 1

only letters

Posted: Sat Sep 18, 2004 12:05 am
by bimo
would this be the correct regex way to say, "pick all the characters until a number is come across"?

Code: Select all

(^.*\D)

Posted: Sat Sep 18, 2004 12:32 am
by feyd
not really...

Code: Select all

#^(ї^\d]*)#
this is for a preg_* function...

Posted: Sat Sep 18, 2004 12:38 am
by bimo
I'm so sorry... I didn't mean to ask that b/c it seems to be working for me. I will try your way too. what I meant to ask was this:

I want to pick out the nth and nth +1 character out after I extract the letters off of the beginning of a string. In other words, after I pick out the letters at the beginning of a string there are 6 numbers. I want to pick out the 1st and scond, 3rd and 4th or 5th and 6th.

I thought about cycling through the string's character array like you can do in C++ but wasn't sure if that was a great idea since the length of the word is indeterminate.

can I cycle through the string backwards (the six digits are always going to be the last six)

your help is much appreciated

Posted: Sat Sep 18, 2004 12:45 am
by feyd

Code: Select all

substr($string,-6)
will fetch the last 6 characters in the string.

Posted: Sat Sep 18, 2004 8:21 am
by bimo
Thank you, feyd.