Top "Preg-replace" questions

preg_replace() is a PHP function that performs string replacement using regular expressions.

Remove multiple whitespaces

I'm getting $row['message'] from a MySQL database and I need to remove all whitespace like \n \t and so …

php regex string preg-replace whitespace
Replacing accented characters php

I am trying to replace accented characters with the normal replacements. Below is what I am currently doing. $string = "Éric …

php string preg-replace non-ascii-characters
PHP remove special character from string

I have problems with removing special characters. I want to remove all special characters except "( ) / . % - &", because I'm setting …

php regex string preg-replace
PHP preg replace only allow numbers

How can I modify this existing preg_replace to only allow numbers? function __cleanData($c) { return preg_replace("/[^A-Za-z0-9]/", "",$…

php preg-replace
PHP replacing special characters like à->a, è->e

I have php document signup.php which save the content from form (in form.php document) to MySQL base. The …

php utf-8 preg-replace decode
Replace deprecated preg_replace /e with preg_replace_callback

$result = preg_replace( "/\{([<>])([a-zA-Z0-9_]*)(\?{0,1})([a-zA-Z0-9_]*)\}(.*)\{\\1\/\\2\}/iseU", "CallFunction('\\1','\\2','\\3','\\4','\\5…

php preg-replace preg-replace-callback php-5.5
Replace preg_replace() e modifier with preg_replace_callback

I'm terrible with regular expressions. I'm trying to replace this: public static function camelize($word) { return preg_replace('/(^|_)([a-z])/…

php regex preg-replace preg-replace-callback
Convert plain text URLs into HTML hyperlinks in PHP

I have a simple commenting system where people can submit hyperlinks inside the plain text field. When I display these …

php regex hyperlink preg-replace
Remove all non-alphanumeric characters using preg_replace

How can I remove all non alphanumeric characters from a string in PHP? This is the code, that I'm currently …

php regex preg-replace
Removing special Characters from string

I am using a function for removing special character from strings. function clean($string) { $string = str_replace('', '-', $string); // …

php regex string preg-replace special-characters