Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 997183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:59:33+00:00 2026-05-16T06:59:33+00:00

I have the following regex: ^[a-zA-Z](.*)[a-zA-Z]$ on both the Javascript and PHP side that

  • 0

I have the following regex: ^[a-zA-Z](.*)[a-zA-Z]$ on both the Javascript and PHP side that I have been using for validating a person’s name and message fields on a contact form (no database interaction). It basically ensures that the first and last character in the field are alphabets, and allows anything else in-between.

My concerns are:

  1. For this type of functionality, should I be bothered with trying to validate a person’s name or message? The only thing I am validating or rather protecting against is any malicious input.
  2. I’m unsure what type of attacks I could leave my site open to, if the only thing I do is check that the fields aren’t empty.

Are these valid concerns? If I start catering for all types of Name and Message scenarios, I’m going to end up with a very long expression that will become too difficult to maintain…So is it really worth it, or is there a bare-minimum regex that I should use for these 2 fields to protect against malicious attacks/scripting?

(PS – I’ve just been reminded by one of my co-workers about names beginning with an ” ! “)

THANK YOU!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:59:33+00:00Added an answer on May 16, 2026 at 6:59 am

    Now someone named Dieter Voß can’t use your contact form anymore. That’s bad.

    If you don’t have any database interaction and the data is sent to someone via e-mail or the like (as opposed to being displayed publicly on the web), then there’s not much of an security concern to protect yourself against. I’d recommend simply doing no check at all. (Except maybe whether the fields are empty.)

    Disclaimer: Without knowing about the rest of the code, any statements about possible security implications can possibly be wrong.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To outline: I have a parser that grabs Cell references using the following regex
I have the following Regex that matches XAML tags: <[^<>]*> This would return both
I have the following regex that isn't working. I want to match the string
In Python compiled regex patterns have a findall method that does the following: Return
I have the following regex in PHP: /(?<=\')[^\'\s][^\']*+(?=\')|(?<=)[^\s][^]*+(?=)|[^\',\s]+/ and I would like to port
I need to create a regex in PHP that will identify the following tokens
I have the following regular expression for validating a file name: ^(([a-zA-Z]:|\)\)?(((.)|(..)|([^\/:*\?\|<>. ](([^\/:*\?\|<>. ])|([^\/:*\?\|<>]
Currently, I have the following Python regex: r'^https?://(www.)?domain.com/?(?P<path>.*)/?$' That I'm replacing with: r'/\g<path>/' This
I have the following regex expression to match html links: <a\s*href=['|](http:\/\/(.*?)\S['|]> it kind of
I have the following RegEx id=(.*?) | id=(.*?) The reason for this is I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.