Jump to content


Photo

quick question


  • Please log in to reply
2 replies to this topic

#1 frustrated

frustrated
  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts

Posted 21 April 2006 - 06:08 PM

Is there an easy way to strip a string of all non-alphebetical characters and numbers?

#2 Ninjakreborn

Ninjakreborn
  • Members
  • PipPipPip
  • Information Technology Specialist
  • 3,922 posts
  • Age:33

Posted 21 April 2006 - 06:19 PM

yes but I am not sure how to put all of those pieces together. I can tell you that there is a whole chunk of functions for doing that type of thing in different ways, there are those that if utilized properly you can probably achieve that.

------

Business Website: http://www.infotechnologist.biz

Personal Website: http://www.joyelpuryear.com

Blog Site: http://www.realmofwriting.com
Services: Web development, application development, mobile development, and custom development. All services listed on my website.


#3 jworisek

jworisek
  • Members
  • PipPipPip
  • Advanced Member
  • 112 posts

Posted 21 April 2006 - 06:39 PM

try something like this:

$string="aslj234u0jlkj3l4k+-043%";

$replace = preg_replace('/[\d]*[^\w]*/','',$string);

// the [\d] will remove all numbers
// the [^\w] will remove all non a-zA-Z0-9_





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users