On 23 June 2010 01:03, Rick Dwyer rpdw...@earthlink.net wrote:
$find = '/[^a-z0-9]/i';
Replace that with ...
$find = '/[^a-z0-9]++/i';
And now you only need ...
$new_string = trim(preg_replace($find, $replace, $old_string));
--
-
Richard Quadling
Standing on the shoulders of some very
Hello List.
I need to remove characters from a string and replace them with and
underscore.
So instead of having something like:
$moditem = str_replace(--,_,$mystring);
$moditem = str_replace(?,_,$mystring);
$moditem = str_replace(!,_,$mystring);
etc.
For every possible character I can
-general@lists.php.net
Subject: [PHP] Stripping Characters
Hello List.
I need to remove characters from a string and replace them with and
underscore.
So instead of having something like:
$moditem = str_replace(--,_,$mystring);
$moditem = str_replace(?,_,$mystring); $moditem =
str_replace
On Tue, 2010-06-22 at 11:40 -0400, Rick Dwyer wrote:
Hello List.
I need to remove characters from a string and replace them with and
underscore.
So instead of having something like:
$moditem = str_replace(--,_,$mystring);
$moditem = str_replace(?,_,$mystring);
$moditem =
Perhaps, ereg_replace(your regex, replacement_string, String
$variable).
Regards,
Shreyas
On Tue, Jun 22, 2010 at 9:10 PM, Rick Dwyer rpdw...@earthlink.net wrote:
Hello List.
I need to remove characters from a string and replace them with and
underscore.
So instead of having something
On 22 June 2010 16:44, Ashley Sheridan a...@ashleysheridan.co.uk wrote:
On Tue, 2010-06-22 at 11:40 -0400, Rick Dwyer wrote:
Hello List.
I need to remove characters from a string and replace them with and
underscore.
So instead of having something like:
$moditem =
On Tue, Jun 22, 2010 at 9:40 AM, Rick Dwyer rpdw...@earthlink.net wrote:
Hello List.
I need to remove characters from a string and replace them with and
underscore.
So instead of having something like:
$moditem = str_replace(--,_,$mystring);
$moditem = str_replace(?,_,$mystring);
Then, when does one use ereg_replace as against preg_replace? I read from
one the forums that preg_* is faster and ereg_* is if not faster but
simpler.
Is that it?
Regards,
Shreyas
On Tue, Jun 22, 2010 at 9:58 PM, Richard Quadling rquadl...@gmail.comwrote:
A word character is any letter or
Thanks to everyone who responded.
Regarding the myriad of choices, isn't Ashley's, listed below, the one
most like to guarantee the cleanest output of just letters and numbers?
--Rick
On Jun 22, 2010, at 11:44 AM, Ashley Sheridan wrote:
On Tue, 2010-06-22 at 11:40 -0400, Rick Dwyer
On Tue, 2010-06-22 at 13:35 -0400, Rick Dwyer wrote:
Thanks to everyone who responded.
Regarding the myriad of choices, isn't Ashley's, listed below, the one
most like to guarantee the cleanest output of just letters and numbers?
--Rick
On Jun 22, 2010, at 11:44 AM, Ashley
Shreyas Agasthya wrote:
Then, when does one use ereg_replace as against preg_replace? I read from
one the forums that preg_* is faster and ereg_* is if not faster but
simpler.
BUT, all the ereg_* has been depricated. DO NOT USE THEM if you want your code
to work in the future. :)
Is that
Hello again list.
My code for stripping characters is below. I'm hoping to get feedback
as to how rock solid it will provide the desired output under any
circumstance:
My output must look like this (no quotes):
This-is-my-string-with-lots-of-junk-characters-in-it
The code with string
On Tue, 2010-06-22 at 20:03 -0400, Rick Dwyer wrote:
Hello again list.
My code for stripping characters is below. I'm hoping to get feedback
as to how rock solid it will provide the desired output under any
circumstance:
My output must look like this (no quotes):
Very good.
Thank you.
--Rick
On Jun 22, 2010, at 8:14 PM, Ashley Sheridan wrote:
On Tue, 2010-06-22 at 20:03 -0400, Rick Dwyer wrote:
Hello again list.
My code for stripping characters is below. I'm hoping to get
feedback
as to how rock solid it will provide the desired output under
Hello all,
Does anyone have any snippets of code that will strip several characters
from a string? I am trying to figure out how to do this without using 3
different if statement blocks. This is what I am looking for.
ieUser email address is Chris Ditty
[EMAIL PROTECTED] or Chris
Clarification:
So really, what you want to achieve is to ONLY have the email address?
I'm POSITIVE there's a better way with ereg_replace(), but I haven't got
time to experiment, and i'm no expert :)
So, what I figured was that you would loop through the $email, and if the
first char wasn't a ,
16 matches
Mail list logo