Jump to content

[SOLVED] Removing sertan text


ramli

Recommended Posts

I want to replace the text between the quote]/quote] including the [] itself to [...]

 

So :

 

fdhskfsjkfhdsjkfhdskjlfhdskjfhldskjfhj

quote] hier een heel verhaal, altijd ierst anders aoiufhv;awoghaer;ogihja;goiherw /quote]

jasdhklasdkjh

 

Should be:

fdhskfsjkfhdsjkfhdskjlfhdskjfhldskjfhj

[...]

jasdhklasdkjh

 

Can anybody assist me with this problem ? thanks in advance

 

Link to comment
Share on other sites

humm

 

this works

 

<?php
$string = 'Hello [quote] how are you [\quote] sorry';
$pattern[] = '/\[quote\].*\[\\\quote\]/';
$replacement[] = 'oops';
echo preg_replace($pattern, $replacement, $string);
die;
?> 

 

 

 

Updated

 

 

Sorry still learning RegEx

Link to comment
Share on other sites

was the first thing i tried it failed!!

 

which is weird on a wim i tryed \\\ and it worked!!

 

 

EDIT

Update got the / around the wrong way on the string corrected

<?php
$string = 'Hello [quote] how are you [/quote] sorry';
$pattern[] = '/\[quote\].*\[\/quote\]/';
$replacement[] = 'oops';
echo preg_replace($pattern, $replacement, $string);
die;

?>

 

 

 

D'Oh!

 

 

Well you learn from your mistakes and well i make loads ;D

Link to comment
Share on other sites

When someone is asking for clarification on something mentioned in a particular thread, it is definitely not hijacking. Don't be ridiculous. You'd prefer that someone start a new thread, ask their question, and then provide a link to the original thread so everybody knows what's going on? It's only hijacking if someone takes a thread and asks a completely irrelevant question.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.