Welcome to WebmasterWorld Guest from 54.145.13.215

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

regex to validate new line <br/>

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

Senior Member from US 

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

joined:Apr 19, 2003
posts: 4388
votes: 2


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) )

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

Junior Member

5+ Year Member

joined:Dec 19, 2006
posts:92
votes: 0


the following pattern matches paragraphs

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

Hope that helps in some way

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

Senior Member from US 

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

joined:Apr 19, 2003
posts: 4388
votes: 2


Thanks
but it does not help my quest
8:25 pm on Aug 16, 2008 (gmt 0)

Full Member

10+ Year Member

joined:Sept 7, 2005
posts:242
votes: 0


This will match a line feed: /\r*\n¦%0a¦%0d/
10:01 pm on Aug 16, 2008 (gmt 0)

Senior Member from US 

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

joined:Apr 19, 2003
posts: 4388
votes: 2


Thanks, that did it.