homepage Welcome to WebmasterWorld Guest from 54.197.19.35
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
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




msg:3723050
 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




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

the following pattern matches paragraphs

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

Hope that helps in some way

henry0




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

Thanks
but it does not help my quest

BananaFish




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

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

henry0




msg:3724620
 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