Search in hashtable with regular expressions.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Karlen
    New Member
    • May 2010
    • 5

    Search in hashtable with regular expressions.

    I have a hashtable and I want to search any word in it. Can I make the search with regular expressions?
    Last edited by Niheel; May 10 '10, 10:50 AM. Reason: punctuation, grammar
  • Monomachus
    Recognized Expert New Member
    • Apr 2008
    • 127

    #2
    Originally posted by Karlen
    Hello,
    i have a hashtable and i want to search any word in it. Can i make the search with regular expressions?
    Thank you.
    of course, why not? You have Hashtable.Keys and Hashtable.Value s. You can search in them because those are ICollections.

    If you search for a key and it matches your pattern you could easily find the value for this key. Example: hashTable["ghost"] - It will print me out the value which corresponds to key "ghost".

    If you search for a value and it matches your pattern it would be something not so easy to do. I mean to find the key for this value.

    But since we know that key from hashtable.Keys[1] should correspond to value from hashtable.Value s[1] you should return the index from Values which matched with your search and it's key would be Keys[j].

    Hope this helps.

    Comment

    • Karlen
      New Member
      • May 2010
      • 5

      #3
      Originally posted by Monomachus
      of course, why not? You have Hashtable.Keys and Hashtable.Value s. You can search in them because those are ICollections.

      If you search for a key and it matches your pattern you could easily find the value for this key. Example: hashTable["ghost"] - It will print me out the value which corresponds to key "ghost".

      If you search for a value and it matches your pattern it would be something not so easy to do. I mean to find the key for this value.

      But since we know that key from hashtable.Keys[1] should correspond to value from hashtable.Value s[1] you should return the index from Values which matched with your search and it's key would be Keys[j].

      Hope this helps.
      Thank you very much.

      Comment

      Working...