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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:08:49+00:00 2026-06-02T06:08:49+00:00

I am referring to the test harness listed here http://docs.oracle.com/javase/tutorial/essential/regex/test_harness.html The only change I

  • 0

I am referring to the test harness listed here http://docs.oracle.com/javase/tutorial/essential/regex/test_harness.html

The only change I made to the class is that the pattern is created as below:

Pattern pattern = 
        Pattern.compile(console.readLine("%nEnter your regex(Pattern.CANON_EQ set): "),Pattern.CANON_EQ);

As the tutorial at http://docs.oracle.com/javase/tutorial/essential/regex/pattern.html suggests I put in the pattern or regex as a\u030A and string to match as \u00E5 but it ends on a No Match Found. I saw both the strings are a small case ‘a’ with a ring on top.

Have I not understood the use case correctly?

  • 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-02T06:08:51+00:00Added an answer on June 2, 2026 at 6:08 am

    The behavior you’re seeing has nothing to do with the Pattern.CANON_EQ flag.

    Input read from the console is not the same as a Java string literal. When the user (presumably you, testing out this flag) types \u00E5 into the console, the resultant string read by console.readLine is equivalent to "\\u00E5", not “å”. See for yourself: http://ideone.com/lF7D1

    As for Pattern.CANON_EQ, it behaves exactly as described:

    Pattern withCE = Pattern.compile("^a\u030A$",Pattern.CANON_EQ);
    Pattern withoutCE = Pattern.compile("^a\u030A$");
    String input = "\u00E5";
    
    System.out.println("Matches with canon eq: "
        + withCE.matcher(input).matches()); // true
    System.out.println("Matches without canon eq: "
        + withoutCE.matcher(input).matches()); // false
    

    http://ideone.com/nEV1V

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

Sidebar

Related Questions

Long story short, I'm wanting to test my site's anti-bot systems (bot here referring
I'm referring to this test in about_symbols.rb in Ruby Koans https://github.com/edgecase/ruby_koans/blob/master/src/about_symbols.rb#L26 def test_method_names_become_symbols symbols_as_strings
Referring to the first answer about python's bound and unbound methods here, I have
Referring here A is a precompiled Java class (I also have the source file)
Referring to the code below, is there a way to bind the test 2
EDIT: Managed to test it all and I guess my friend was wrong here,
I am referring to the following source: http://clpbar.sourceforge.net Build process is the standard: ./configure
referring to this question: add class to regex jquery I would like to know
class test: a=hi def msg(self): print the variable for which the object is referring
I am referring to JUnit annotations like @test, @before , @after. e.g i can

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.