a123123 Posted June 22, 2012 Share Posted June 22, 2012 Hello I have the following code: <?php $patterns = array('/(?s)(?<=\s)(\s|,|\\\|\^|\(|\)|\[(?!t)|(?<!t)\]|{|}|0-9|\-|\=|\+|b|c|d|f|g|h|j|k|l|m|n|p|r|s|(?<!t)x|B|C|D|F|G|H|J|K|L|M|N|P|R|S|T|X|.\(.\)|)+(?=(\s|\.)(??!\[\/t\]).|\n)*\[te\])/'); $replacements = array('[t]$1[/t]'); $string=$_POST['kod']; echo preg_replace($patterns, $replacements, stripslashes($string)); ?> I want it to: 1) dot matches newline 2) every string which is followed by space or newline and contains: coma, backslash \, ^, (, ), [, ], {, }, digits, -, =, +, small and big letters, every .(.) series, and is between [/t] and [t] characters (example: [/t] ... string ... [t]), would be changed to [t]$1[/t]. But it doesn't work - only newlines are changed. Where is a problem? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.