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

  • SEARCH
  • Home
  • 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 8086877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:35:10+00:00 2026-06-05T18:35:10+00:00

Need some regular expressions help. So far I have my code working to allow

  • 0

Need some regular expressions help.

So far I have my code working to allow a limited number of special characters. However, I don’t know how to get it to only allow them in the middle and never the end.

Can someone help me figure that part out?

Here is the code I am using in c#:

            Regex uRLToVal= new Regex("^[A-Za-z0-9-_.+!*]*$");

            if (!uRLToVal.IsMatch(this.mainURL))
            {
                results.AddPropertyError("Your Entry can only contain letters, numbers, underscores, periods, plus, exclamation marks and hypens. Special characters should always be inside numbers or letters.  Example: v!v is OK BUT NOT !vv or vv!");
            }
  • 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-06-05T18:35:11+00:00Added an answer on June 5, 2026 at 6:35 pm
    new Regex(@"^[A-Za-z0-9]+([-_.+!*]+[A-Za-z0-9]+)*$");
    

    which means :

    match must begin with at least one numeric or alpha char:[A-Z-z0-9]+

    That sequence may be followed by zero or many special chars -_.+!* followed by at least one numeric or alpha char.
    This second combination can happen zero or many times (example : asdf-e*r!asdf, or a are valid)

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

Sidebar

Related Questions

I really need some help in Regular Expressions, i'm working on a function like
I'm a newbie with regular expressions and i need some help :). I have
I need some help extracting the following bits of information using regular expressions. Here
Greetings all, I need help combining some htaccess rewrites, these crazy regular expressions screw
I need some help in evaluating a regular expression in some code.I am trying
I have some complex regular expressions which I need to comment for readability and
I need help again with some regular expressions I'm trying to do (still under
I'm completely incapable of regular expressions, and so I need some help with a
Team: I need some help with some regular expressions. The goal is to be
I am new to regular expressions and need some help. How can I turn

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.