PHP How to remove lines that are less than 6 characters

coderchase

New Member
I am sorting through some lines and some contain email, some don't.I need to remove all lines less than 6 characters.I did a little surfing and found no solid answers so, I tried to write my first expression.Please tell me if this will work. Did I get it right?\[code\]$six-or-more = preg_replace("!\b\w{1,5}\b!", "", $line-in); \[/code\]Followed by the below which I "stole" which may in fact be superfluous. \[code\]$no-empty-lines = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $six-or-more);$lines = preg_split("/[\s]*[\n][\s]*/", $no-empty-lines);\[/code\]You can see what I am trying to do but, I think it is a bit much.Thanks for the tutorial.
 
Back
Top