View Full Version : Regular Expression
12-09-2004, 09:12 AM
I would like to replace any string with this format :
[any thing inside]
to remove the text inside  + the brackets
thank you for your help
12-09-2004, 09:53 AM
If you simply want to remove both the square brackets and the arbitrary content they enclose (allowing for multiline and case-insensitivity), this ought to do it:
$string = $your_text_source;
$pattern = '/\[((im).+)\]/';
$replace = '';
preg_replace($pattern, $replace, $string);
12-09-2004, 10:37 AM
of course i am not using php but asp net
but i shall try "/\[((im).+)\]/'"
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.