Welcome to WebmasterWorld Guest from 50.17.74.162

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

regex to validate new line <br/>

     

henry0

4:32 pm on Aug 14, 2008 (gmt 0)

WebmasterWorld Senior Member henry0 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



I need to allow for char, num and those few signs
but cannot figure how to allow for r\n and <br />
as tags comming from a text area new line (break)

so far I got that one:

if (!preg_match("/^[a-zA-Z0-9 \&\;\.\-\,\?\r\nŠ\nŠ\r]+$/",$answer) )

darrenG

6:32 pm on Aug 14, 2008 (gmt 0)

5+ Year Member



the following pattern matches paragraphs

"/\n(\s)+/U"

Hope that helps in some way

henry0

7:22 pm on Aug 14, 2008 (gmt 0)

WebmasterWorld Senior Member henry0 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Thanks
but it does not help my quest

BananaFish

8:25 pm on Aug 16, 2008 (gmt 0)

5+ Year Member



This will match a line feed: /\r*\n¦%0a¦%0d/

henry0

10:01 pm on Aug 16, 2008 (gmt 0)

WebmasterWorld Senior Member henry0 is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Thanks, that did it.