EDIT: I figured out how to add a string to the PCRE command. I was adding quotes to the string, but when I removed the quotes it behaved fine.
Hmm? I don't understand you. PHP strings require quotes (generally).
I find the things interesting, because I am curious to learn the new tricks you showed me. I didn't think to look at the preg replace documentation. I was looking at the PCRE syntax page at php.net.
The following is the code I was talking about. heh, I am not sure what you mean about the string requiring quotes
I notice that sometimes they do and sometimes they don't. In the following example I could not get it to work unless I left the single and double quotes out. Don't even know what made me think to try it without quotes, but it worked.
Code:
$text="44,.:,:-,::227,229";
$text=preg_replace(array('/[^\d,-]/', '/[^\d-]*(-)[^\d-]*/', '/^\D/', '/\D$/'), '$1', $text);
echo "$text";
I want to play around with it a bit more and read up on the preg_replace() function in greater detail as well as the /e documentation 
later
Bookmarks