Regular Expression Sanitize (PHP)

Posted by atif089 on Stack Overflow See other posts from Stack Overflow or by atif089
Published on 2010-06-11T11:03:57Z Indexed on 2010/06/11 11:22 UTC
Read the original article Hit count: 220

Hello,

I would like to sanitize a string in to a URL so this is what I basically need.

  1. Everything must be removed except alphanumeric characters and spaces and dashed.
  2. Spaces should be converter into dashes.

Eg.

This, is the URL!

must return

this-is-the-url

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about regex