nix, shell, perl, php, mysql and mac os x tips and tricks

Tuesday, July 24, 2007

regex to grab the first n characters of a string, respecting words

^(.{0,MAXCHAR}[^ ,.]*)(.*)

No comments:

Post a Comment