View Full Version : Regular Expression
12-09-2004, 10: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, 10: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, 11: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 © 2015 vBulletin Solutions, Inc. All rights reserved.