Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    CBG
    CBG is offline
    New Coder
    Join Date
    Feb 2010
    Location
    UK
    Posts
    91
    Thanks
    26
    Thanked 0 Times in 0 Posts

    Question preg_match help to allow enter in textarea box

    Hi,

    I currently have the below code to check the textarea box.

    PHP Code:
        if (preg_match("#^[a-zA-Z0-9 .,?_/'!£$%&*()+=-]+$#"$msgs)) {
            
    // Everything ok. Do nothing and continue
        
    } else {
            echo 
    "Message is not in correct format.<br>You can use a-z A-Z 0-9 . , ? _ / ' ! £ $ % * () + = - Only"
    However the problem is, when putting enter in the message if fails
    For example if I put the message

    this
    message
    doesnt
    work
    It fails and echo the else

    But if I put
    this message does work
    It is ok


    Could someone tell me what extra bit of code I need to add to the preg_match and where.

    Thanks for the help
    Last edited by CBG; 12-15-2010 at 12:27 PM.
    Regards,
    CBG

  • #2
    CBG
    CBG is offline
    New Coder
    Join Date
    Feb 2010
    Location
    UK
    Posts
    91
    Thanks
    26
    Thanked 0 Times in 0 Posts
    Got help from another forum I posted on.
    Answer was: #^[a-zA-Z0-9 \.,\?_/'!£\$%&*()+=\r\n-]+$#
    Regards,
    CBG


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •