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 6887549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:53:54+00:00 2026-05-27T05:53:54+00:00

I was trying to create a regular expression which validate !! If the text

  • 0

I was trying to create a regular expression which validate !!

  1. If the text has only special character(s), or spaces , It should validate false …

Ex : @#$##

  1. If it has some text along with special characters at the end, it should return true…

EX : Test!!

  1. If it is starting with a special character apart from space or . It should validate to false.

Ex : @#Test

  1. If the special character, except space or coma, comes in between. it should validate to false !!

Ex : te#$ sT

I apologize that, for this complex regular expression, my knowledge do not allow me to put any code which I tried. Because I got nothing apart from [a-b A-B !@#$%^&*()]

UPDATE

  1. Testing with Fischermaen’s Answer – ^(\s|\w)\w*\W*$

sdf SDF! : Validate to false

___ : validate to true (Under scores)

sadf,sdfsdf : validate to false

Empty Spaces : Validate to true

  • 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-27T05:53:55+00:00Added an answer on May 27, 2026 at 5:53 am

    Try this:

    foundMatch = Regex.IsMatch(subjectString, @"^(?!\W*$)(?=[ .\w]\w*\W*$).*$");
    

    I got a headache trying to figure out what you meant. You must learn to express yourself better.

    Explanation:

    "
    ^            # Assert position at the beginning of the string
    (?!          # Assert that it is impossible to match the regex below starting at this position (negative lookahead)
       \W        # Match a single character that is a “non-word character”
          *      # Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
       $         # Assert position at the end of the string (or before the line break at the end of the string, if any)
    )
    (?=          # Assert that the regex below can be matched, starting at this position (positive lookahead)
       [ .\w]    # Match a single character present in the list below
                 # One of the characters “ .”
                 # A word character (letters, digits, etc.)
       \w        # Match a single character that is a “word character” (letters, digits, etc.)
          *      # Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
       \W        # Match a single character that is a “non-word character”
          *      # Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
       $         # Assert position at the end of the string (or before the line break at the end of the string, if any)
    )
    .            # Match any single character that is not a line break character
       *         # Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
    $            # Assert position at the end of the string (or before the line break at the end of the string, if any)
    "
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a regular expression with a character class that has
I am trying to create a regular expression which will look for a email
I am trying to create a regular expression in C# that allows only alphanumeric
I am looking for a regular expression which accepts the text with spaces and
I'm trying to create regular expression that filters from the following partial text: amd64
I'm creating a CSS editor and am trying to create a regular expression that
Hey guys - I'm tearing my hair out trying to create a regular expression
I'm no expert on Regex. I'm trying to create a regular expression that will
this one is really easy. I'm trying to create a Regular Expression that will
I am trying to create a JavaScript regular expression that can find a keyword

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.