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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:22:47+00:00 2026-06-12T12:22:47+00:00

Note: I’m using a 3rd party app that uses regex for searches which has

  • 0

Note: I’m using a 3rd party app that uses regex for searches which has its own flavor but almost always works like java’s flavor of regex. Of course this may not matter.

After searching for many different ways of this same question (phrased many ways), I did not see any tutorials, examples, or even mentions of whether it is possible to use both an “is” (positive?) and “is not” (negative?) definition within the same range.

I can’t run a test the example right now in the app to see if my ideas work, because the amount of data being searched is massive and will screw up the matches it has already gathered. I’m only asking because of this.

Here are examples of what I thought might work but caused tester to act weird:

[\w^\s<>.!?]{2}
[\w|^\s<>.!?]{2}

I would rather have it work the way I think the first one would work (any digit, lower case, or upper case character, or other normal character that is not a space, >, <, period, !, or ?) rather then the second which only has an or operator.

The regex testers I used gave me different funky results which is what is confusing me.

Also note: I’m using this within a capture group which is followed by a catch everything match which I may or may not be using properly. So if you’d like to include how to follow what I’m attempting with how to properly do that, feel free. I AM MAINLY JUST CURIOUS TO IF THIS WAS POSSIBLE OR NOT, OR IF IT WAS A IMPROPER METHOD.

  • 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-12T12:22:49+00:00Added an answer on June 12, 2026 at 12:22 pm

    Why do you need the \w at all?

    [^\s<>.!?]{2}
    

    This already matches all alphanumeric characters since they are neither space nor any of the punctuation characters you mentioned.

    In general, you can substract character classes to some degree, for example, to match alphanumerics exluding digits, you can do

    [^\W\d]
    

    because [^\W] matches the same as \w, and \d is substracted from that because it’s in a negated character class.

    Edit:

    Some regex engines (like XPath, .NET and JGSoft) allow flexible character class substraction like this:

    [a-z-[e-g]]
    

    to match any character from the range [a-z], excluding e, f and g. But Java does not have this feature.

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

Sidebar

Related Questions

NOTE: This question has been renamed. Originally it targeted the fact that I was
Note that I am not asking which to choose (MVC or MVP), but rather
Note, this is not a duplicate of .prop() vs .attr() ; that question refers
NOTE: This is a followup to my question here. I have a program that
Note: I had another similar question about how to GZIP data using Ruby's zlib
NOTE: The scenario is using 2 entity framework models to sync data between 2
Note that when I say client, I mean businesses or organizations that have signed
Note: I know that elem {height: 90%} exists. What I need: an element to
Note: Before you spend your time reading on, please know that C2DM is itself
Note: PopupMenu is available with API level 11 and higher. http://developer.android.com/guide/topics/ui/menus.html#PopupMenu With that in

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.