adding keyboard enter key to regular expression in JavaScript function to validate textarea

Hi experts,

I'm using JavaScript and a regular expression to validate input in a TextArea.

Here is my working fiddle:

When a user types in /> inside the text area, they get the message "Sorry that input is invalid"

When a user types in </ inside the text area, they get the message "Sorry that input is invalid"

These two case are correct and validation message should show up. Any other input is valid.

But I noticed when I press the Enter key on my keyboard that is also failing the validation and causing the message "Sorry that input is invalid" to display.

How do I fix my example, so pressing the Enter Key on my board doesn't cause the validation to fail?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SwapnilSoftware ArchitectCommented:
Here you go, use below . is not considering new line, so required to add \n . I also updated the jsfeedle.



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
maqskywalkerAuthor Commented:
thanks. great solution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Regular Expressions

From novice to tech pro — start learning today.