Top "Preg-replace" questions

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

Trouble Replacing Apostrophe with Preg_Replace

I am attempting to remove apostrophes from text and it isn't really working. It's got to be something small. $text = …

php preg-replace
PHP7 - The /e modifier is no longer supported, use preg_replace_callback instead

Can somebody help me with this error I'm getting? Warning: preg_replace(): The /e modifier is no longer supported, use …

php preg-replace preg-replace-callback
PHP preg_replace: Case insensitive match with case sensitive replacement

I'm using preg_replace in PHP to find and replace specific words in a string, like this: $subject = "Apple apple"; …

php regex preg-replace
How to use preg_replace to remove anything from a certain character on until the end of a string?

Hi I need to remove all characters from the '_' until the end of the string. I tried with: $…

php preg-replace
PHP preg_replace \

Really simple question: how can I preg_replace the backslash character?

php preg-replace
preg_replace '</p>' with '<br />'?

I have my code removing the <p> starting tags, but now I want to replace the ending </…

php preg-replace
How replace all spaces inside HTML elements with &nbsp; using preg_replace?

I need replace spaces with &nbsp; inside HTML elements. Example: <table atrr="zxzx"><tr> <…

php html preg-replace spaces
Regex Optional Groups?

I seem to have confused myself with a preg_match regex I'm doing, so fresh eyes and help would be …

php regex preg-replace preg-match
remove <br>'s from the end of a string

as the title says i have a string like this: $string = "Hello World<br>hello world<br&…

php regex preg-replace
How can I get at the matches when using preg_replace in PHP?

I am trying to grab the capital letters of a couple of words and wrap them in span tags. I …

php regex html-parsing preg-replace