#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Location
    kerala, India
    Posts
    81
    Rep Power
    2

    Add Space in preg_match


    Hi Friends,

    My mission is to check a data it contains special characters with the help of php. So i prefer preg_match.

    Example:
    preg_match("#\W+#", $_REQUEST['txt_companyType']);

    I need results just like Hello world. But above code doesn't support spaces. Please help me for adding spaces between words.

    Thanks & Regards
    SarathPHP
  2. #2
  3. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,294
    Rep Power
    9400
    PHP Code:
    preg_match('#[^\w ]#'$_REQUEST['txt_companyType']) 
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Location
    kerala, India
    Posts
    81
    Rep Power
    2
    Originally Posted by requinix
    PHP Code:
    preg_match('#[^\w ]#'$_REQUEST['txt_companyType']) 
    Thank you so much.

IMN logo majestic logo threadwatch logo seochat tools logo