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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:53:06+00:00 2026-05-18T12:53:06+00:00

Using Perl style regexp, is it possible to look for something not of certain

  • 0

Using Perl style regexp, is it possible to look for something not of certain pattern?

For example, [^abc] looks for a SINGLE CHARACTER not a nor b nor c.

But can I specify something longer than a single character?
For example, in the following string, I want to search for the first word which is not a top level domain name and contains no uppercase letter, or perhaps some more complicated rules like having 3-10 characters. In my example, this should be "abcd":

net com org edu ABCE abcdefghijklmnoparacbasd abcd
  • 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-18T12:53:07+00:00Added an answer on May 18, 2026 at 12:53 pm

    You can do it using negative look-ahead assertions as:

    ^(?!(?:net|com|org|edu)$)(?!.*[A-Z])[a-z]{3,10}$
    

    See it

    Explanation:

    ^                   - Start anchor
    $                   - End anchor
    (?:net|com|org|edu) - Alternation, matches net or com or org or edu
    (?!regex)           - Negative lookahead. 
                          Matches only if the string does not match the regex.
    

    So the part (?!(?:net|com|org|edu)$) ensures that input is not one of the top level domains.

    The part (?!.*[A-Z]) ensures that the input does not have a upper case letter.

    The part [a-z]{3,10}$ ensures that the input is of length atleast 3 and atmost 10.

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

Sidebar

Related Questions

Using Perl, how do I capture a single character from STDIN without needing the
Replacing the Special Character using Perl while i am doing this . I got
We have been using Perl's Net:Twitter CPAN module (version 3.12) and basic authentication (not
My task is to extract some data from a given document using Perl-style (or
Using Perl, how do I check if a particular Windows process is running or
I am using Perl to do text processing with regex. I have no control
I am using Perl to convert some XML to JSON. If the XML attribute
I'm using Perl's DBI module. I prepare a statement using placeholders, then execute the
I'm using Perl/Tk to build the GUI for an application. I plan on adding
So I've been using Perl for several years now and I'm starting to dabble

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.