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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T18:10:21+00:00 2026-06-03T18:10:21+00:00

i need a certain string to be in this format: [0000] anyword so between

  • 0

i need a certain string to be in this format:
[0000] anyword

so between the [] brackets i need 4 numbers, followed by a whitespace. after that only characters ranging from a to z and – characters are allowed.

so this should be allowed:

[0000] foo-bar

[0000] foo

[0000] foo-bar-foo

etc..

so far i have this:

\[[0-9]{4}\]\s

this matches the [0000] , so it maches the brackets with 4 numbers in it and the whitespace.
i can’t seem to find something that allows charachters after that. i’ve tried putting a single “.” at the end of the expression as this should match any character but this doesnt seem to be working.

\[[0-9]{4}\]\s^[A-Z]+[a-zA-Z]*$

the above isn’t working either..

i need this expression as a Validationexpression for an asp.net custom validator.

any help will be appreciated

  • 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-03T18:10:22+00:00Added an answer on June 3, 2026 at 6:10 pm

    This works for your input: http://regexr.com/?30sb7. Unlike Cornstalk’s answer it does not capture anything, and - can indeed be placed later in a range if it’s escaped.

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

Sidebar

Related Questions

I need to replace a string in certain documents. I have googled this code,
I need to search for all users containing a certain text string in their
I need to save images in certain folder of my application: string path=E:\AJAXEnabledWebSite1\images\gallery I
I need certain scripts to refire after an AJAX load. How could I accomplish
I need send certain attributes(say, human readable user name) from server to client after
My current thinking: I need a certain module that will let me access the
I am currently working on a project where I need to format a string
I have certain code that I want to optimize. It looks like this: function
I need to write a split function in JavaScript that splits a string into
I need to be able to match a certain string ( '[' then any

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.