Top "Preg-replace" questions

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

How to remove `//<![CDATA[` and end `//]]>`?

How can I remove the (//<![CDATA[ , //]]>) blocks; tags inside a script element. <script type="text/javascript"> //&…

php regex preg-replace cdata
Remove backslash \ from string using preg replace of php

I want to remove the backslash alone using php preg replace. For example: I have a string looks like $var = "…

php regex replace preg-replace stripslashes
Regex to strip comments and multi-line comments and empty lines

I want to parse a file and I want to use php and regex to strip: blank or empty lines …

php regex preg-replace
preg_replace in PHP - regular expression for NOT condition

I am trying to write a function in PHP using preg_replace where it will replace all those characters which …

php regex preg-replace
Remove first forward slash in a link?

I need to remove the first forward slash inside link formatted like this: /directory/link.php I need to have: …

php regex preg-replace
check if the string contains alphabets in php

How to check if the string has alphabets in PHP The ctype_alpha and ctype_digit doesn't help in it. …

php regex string preg-replace preg-match
Why preg_replace throws me a "Unknown modifier" error?

I keep getting this error: Warning: preg_match() [function.preg-match]: Unknown modifier 't' in D:\xampp\htdocs\administrator\components\com_…

php preg-replace modifier
PHP readdir and sort

I'm making a little gallery. I want to read the file names off a directory and print the file names …

php sorting preg-replace readdir
Replacing file content in PHP

I need a function just like preg_replace but instead of strings I need it to work with files / file …

php file file-io preg-replace replace
Best way to make links clickable in block of text

I want: Here is link: http://google.com And http://example.com inside. And another one at the very end: …

php regex preg-replace