List Info

Thread: php question--stripping out non letters...




php question--stripping out non letters...
user name
2007-05-14 18:24:07
I was wondering if there's an easy way to strip out all
characters out
of a string that are not letters or numbers?

Any suggestions would be appreciated...

Cheers,
Dan

_______________________________________________
pmwiki-devel mailing list
pmwiki-develpmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel

Re: php question--stripping out non letters...
user name
2007-05-14 23:53:56
I was wondering if there's an easy way to strip out all characters out
of a string that are not letters or numbers?

preg_replace($pattern, $replacement , $string);


Try something like preg_replace( '/[^a-zA-Z0-9]/', '', $string);


Christophe
Re: php question--stripping out non letters...
country flaguser name
Uruguay
2007-05-17 13:09:26
Christophe David wrote:
>     I was wondering if there's an easy way to strip out
all characters out
>     of a string that are not letters or numbers?
> 
> 
> |preg_replace($pattern, $replacement , $string);|
> 
> 
> Try something like | ||preg_replace( '/[^a-zA-Z0-9]/',
'', $string);|
> 


or something like:

                preg_replace('/W+/','',$string)

if you also want to strip underscores:

	   preg_replace('/[W_]+/','',$string)


_______________________________________________
pmwiki-devel mailing list
pmwiki-develpmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel

Re: php question--stripping out non letters...
user name
2007-05-17 13:17:32
On 5/17/07, Guillermo Calderon - INCO <calderonfing.edu.uy> wrote:
> or something like:
>
>                preg_replace('/W+/','',$string)


Actually this is what I ended up using, only without the +.

Cheers,
Dan

_______________________________________________
pmwiki-devel mailing list
pmwiki-develpmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )