PHP Accept line breaks using REGEX -
i want allow line breaks text area input in regex being removed?
$n= ereg_replace("[^a-za-z0-9[:blank:][:space:]&.\n\r\\/+-]+", "", $_request['input']);
use /m
modifier regex.
http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php
m (pcre_multiline)
by default, pcre treats subject string consisting of single "line" of characters (even if contains several newlines). "start of line" metacharacter (^) matches @ start of string, while "end of line" metacharacter ($) matches @ end of string, or before terminating newline (unless d modifier set). same perl. when modifier set, "start of line" , "end of line" constructs match following or before newline in subject string, respectively, @ start , end. equivalent perl's /m modifier. if there no "\n" characters in subject string, or no occurrences of ^ or $ in pattern, setting modifier has no effect.
Comments
Post a Comment