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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T02:57:09+00:00 2026-06-03T02:57:09+00:00

I am new to regex use in Java. I want to validate the input

  • 0

I am new to regex use in Java. I want to validate the input in the text box.

The input in the text box can start with any lowercase alphabet.
But it should not start with dm e.g. dmemployee. Whereas mdemployee will work.
The first character d can be followed by either digit or lowercase character (except m).

Please suggest a regex for this.

Thanks!

  • 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-03T02:57:10+00:00Added an answer on June 3, 2026 at 2:57 am

    What you are looking for is a negative lookahead. Also, your description is a bit confusing. Can this be all numbers and lowercase letters or only lowercase letters with d being allowed to be followed by numbers?

    This regex assumes any mix of lowercase letters and numbers (disallowing dm)

    /^(?!dm)[a-z0-9]+$/
    

    Ah perfect. The other answer here would be if numbers can only follow an initial d

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

Sidebar

Related Questions

I am new to regular expressions. I want to use java's replaceAll() function to
I'm a Java user but I'm new to regular expressions. I just want to
I am entirely new to regex, and am trying to use it to match
Completely new to java and I have been playing around with regex in a
I'm new to Ruby, Regex and Stackoverflow. xD Here's my problem: I want to
I'm having problems with a Java Regex Pattern Syntax expression. toCensor = toCensor.replaceAll((new StringBuilder(((?i)))).append(word).toString(),
I am new to java regex.Please help me. Consider the below paragraph, Paragraph :
How can I use lookbehind in a C# Regex in order to skip matches
i tried to use Regex in c# , but the following code throws an
I'm currently trying to use regular expressions in C#: Regex reg_gameinfo = new Regex(@PokerStars

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.