Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: How to use Regex as a key in Hashmap to match the given string with key in java

  1. #1
    Junior Member
    Join Date
    Apr 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to use Regex as a key in Hashmap to match the given string with key in java

    I have a table which contains list of regular expression and its corresponding value.I have to fetch those value and put it HASHMAP where regex as key.I have to compare the each key with the given string(input) and If matches I have to get the corresponding Value for the regex.

    Your help is highly appreciated.

    Thank you in advance


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: How to use Regex as a key in Hashmap to match the given string with key in java

    What have you tried?

    list of regular expression and its corresponding value
    Can you give some examples? If a regex is a pattern that is matched against a String, couldn't there be many Strings that match?
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Want to Add Duplicate Key in HashMap
    By rampnq in forum Collections and Generics
    Replies: 8
    Last Post: January 17th, 2018, 05:01 PM
  2. Newbie question: Hashmap with composite object key
    By credible58 in forum Java Theory & Questions
    Replies: 0
    Last Post: December 1st, 2012, 01:21 AM
  3. [SOLVED] Get a new key in HashMap with values of another key.
    By Purple01 in forum What's Wrong With My Code?
    Replies: 8
    Last Post: September 21st, 2012, 04:33 AM
  4. Adding key/value pairs from a HashMap in to an ArrayList
    By vb89 in forum Collections and Generics
    Replies: 0
    Last Post: February 26th, 2012, 10:36 PM
  5. check duplicate key and value in hashmap
    By starmandell in forum Algorithms & Recursion
    Replies: 1
    Last Post: February 9th, 2011, 04:25 PM

Tags for this Thread