homepage Welcome to WebmasterWorld Guest from 54.237.213.31
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
regex to validate new line <br/>
henry0

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



 
Msg#: 3723048 posted 4:32 pm on Aug 14, 2008 (gmt 0)

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

5+ Year Member



 
Msg#: 3723048 posted 6:32 pm on Aug 14, 2008 (gmt 0)

the following pattern matches paragraphs

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

Hope that helps in some way

henry0

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



 
Msg#: 3723048 posted 7:22 pm on Aug 14, 2008 (gmt 0)

Thanks
but it does not help my quest

BananaFish

5+ Year Member



 
Msg#: 3723048 posted 8:25 pm on Aug 16, 2008 (gmt 0)

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

henry0

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



 
Msg#: 3723048 posted 10:01 pm on Aug 16, 2008 (gmt 0)

Thanks, that did it.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved