I have a hashtable and I want to search any word in it. Can I make the search with regular expressions?
Search in hashtable with regular expressions.
Collapse
X
-
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. -
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
Comment