preg replace bugs Programming Web Development by cwarn23 …language). So to do that I am using mainly preg replace and str replace. I have been working hard at it for the…last 29 hours but there is just three bugs (or preg replace functions) which is messing up the end result. I have…2#>$3($4)</font>$5',$textb); // one preg replace that works was taken out from this spot. $textb=preg_replace… Problem in Preg Replace Programming Web Development by jhbalaji Recently i was Writing a Preg replace Function in PHP Here is the Code below […quot;</a>"; $body = preg_replace($suchmuster,$replace,$body,200);[/CODE] Since the variable $body contains … there any way to skip the text containing http:// using preg replace function ? Here's an example [CODE] $textlinksname = 'Google'; … Re: preg replace bugs Programming Web Development by ShawnCplus My biggest recommendation would be to use a prebuilt syntax highlighter and just add a syntax extension. [url=http://qbnz.com/highlighter/]GeSHi[/url] is one my my favorites. Re: preg replace bugs Programming Web Development by cwarn23 [QUOTE]My biggest recommendation would be to use a prebuilt syntax highlighter and just add a syntax extension. Geshi is one my my favorites.[/QUOTE] Thanks for that reply and Geshi is doing the job perfectly. So the code below I replaced with the code provided by Geshi (keeping in mind Geshi uses other files) with a few other minor changes to the… Re: Preg replace with callback to replace change parts of links ? Programming Web Development by pritaeas (?!https?://(www\.)?mysite\.com) Replace needs to use `$2` then, instead of `$1` Re: Replace eregi_replace expression with preg_replace Programming Web Development by cereal … is executed or not? From the [documentation:](http://php.net/preg-replace) > preg_replace() returns an array if the subject parameter is… Re: Problem in Preg Replace Programming Web Development by jhbalaji Any updates please :) Re: Problem in Preg Replace Programming Web Development by SikoSoft Have you tried using the word-boundary character in your regular expression? Like this: $suchmuster = "/\b".$textlinksname."\b/i"; That tells the regular expression that it only will match the given phrase if it is a isolated as its own word. In other words, it should catch google in this sentence: Google is a search engine.… Preg match and replace for img urls Programming Web Development by ade92uk I have used preg match to find in a page all img tags: [CODE]&… it has a full url and if it does not replace it with a full url from a variable called $link2… Preg Match and Regex Programming Web Development by CJdamaster … cant find a way to extract the flags and replace them. Some sample code would be: background: LINEAR…decode. Where (if we were using Firefox) the script would replace that with: background: -moz-linear-gradient(top, #FFFFFF 0…the re-writing function depending on the browser, and replace the generic code with browser-specific code? [B]-NEVERMIND… Re: replace word in string with matching key=>value in assoc array Programming Web Development by diafol How about a simple preg match and replace? About 9 lines of code should do it? function change_keys($… Preg replace with callback to replace change parts of links ? Programming Web Development by grakovski Hello there, I got forum (phpbb3) and i have topics with a lot of links, like this: <a href="link..." class="postlink">Link name...</a> in every link i have class="postlink" and i want to add rel="nofollow" for every external link except my domain by check the 'href' definition. Its possible … Re: Preg replace with callback to replace change parts of links ? Programming Web Development by pritaeas $result = preg_replace( '%<a href="(?!http://mysite\.com)(.*?)" class="postlink">%', '<a href="$1" class="postlink" rel="nofollow">', $subject); Re: Preg replace with callback to replace change parts of links ? Programming Web Development by grakovski It works, but i have http:// and https:// links, can you edit to except only 'mysite.com' Thanks! Re: Preg replace with callback to replace change parts of links ? Programming Web Development by pritaeas Just add `s?` Re: Preg replace with callback to replace change parts of links ? Programming Web Development by grakovski Im unfamiliar with regular expressions and i dont know in which place to add this. Sorry but, can you give me full code with this 's?'. edit: i have https:// http:// and https://www Re: Preg replace with callback to replace change parts of links ? Programming Web Development by pritaeas https?:// Re: Preg replace with callback to replace change parts of links ? Programming Web Development by grakovski Yeah i gotcha, but i have https://www, how to escape and them ? I want only the domain name like 'mysite.com'. Re: Preg replace with callback to replace change parts of links ? Programming Web Development by grakovski Not works in that way. I made this: $message = preg_replace( '%<a href="(?!https?://(www\.)?site\.com)" class="postlink">%', '<a href="$2" class="postlink" rel="nofollow" target="_blank">', $message); But not working. Re: Preg replace with callback to replace change parts of links ? Programming Web Development by pritaeas $message = preg_replace( '%<a href="(?!https?://(www\.)?site\.com)(.*?)" class="postlink">%', '<a href="$2" class="postlink" rel="nofollow" target="_blank">', $message); You omitted a part. Re: Preg replace with callback to replace change parts of links ? Programming Web Development by grakovski Oh... I see.. Now its working, thank you! preg replace problem Programming Web Development by MDanz nvm preg replace problem Programming Web Development by Smudly Hi, I am having a pretty difficult time getting files to upload to my server that have a Single Quote in the file name. Example: myfile's.pdf I need to strip the file name of the quote before it uploads to the server. I currently am using SWFUpload and this is the bit of code that was included with it. I need to modify it to remove the … Re: preg replace problem Programming Web Development by hielo try adding the apostrophes to the list of chars in $valid_chars_regex OR simply use str_replace() after your preg_replace() on the code you posted: [CODE] $file_name = preg_replace('/[^'.$valid_chars_regex.']|\.+$/i', "", basename($_FILES[$upload_name]['name'])); $file_name=str_replace("'","",$file_name); if (… Re: Only replace own website url in text with HTML links Programming Web Development by diafol Use preg replace? Re: Replace Text Programming Web Development by Danny159 I was looking at http://php.net/manual/en/function.preg-match.php however im not sure on what the code would be for it! preg_replace() help Programming Web Development by cjohnweb …() line above): > Warning: preg_replace() [function.preg-replace.html]: Unknown modifier 'B' in C:\xampp\htdocs-… 67 > > Warning: preg_replace() [function.preg-replace.html]: Unknown modifier 'a' in C:\xampp\htdocs-… 67 > > Warning: preg_replace() [function.preg-replace.html]: Unknown modifier '/' in C:\xampp\htdocs-wordpress-… Bad words filter through txt file Programming Web Development by ska_defender …array( 'b***', 'p***', 'c***' ); $count = 0; if($replace){ $text = preg_replace($patterns, $replaces, $text, -1, $count);…gt; Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or…gt; Warning: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or… php preg_match vs preg_replace Programming Web Development by shishtawitch … displaying it on page.................how can i do that with preg match or preg replace preg_replace() compilation failed... Help! Programming Web Development by Arrorn …rep = $row['bbcode_replace']; $rep = str_replace("{base_url}", $base_url, $rep); $replace[$i] = $rep; } } else { if ($row['bbcode_useoption']==1){ if ($row['…it gives me this error. [CODE]Warning: preg_replace() [function.preg-replace]: Compilation failed: missing terminating ] for character class at offset …