# H5LTfind\_dataset matches strings or substrings?

**URL:** <https://forum.hdfgroup.org/t/h5ltfind-dataset-matches-strings-or-substrings/3663>\
**Category:** Hdf-forum archives\
**Created:** [January 21, 2016, 10:14pm UTC](https://forum.hdfgroup.org/t/h5ltfind-dataset-matches-strings-or-substrings/3663 "2016-01-21T22:14:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![borreguero](https://forum.hdfgroup.org/user_avatar/forum.hdfgroup.org/borreguero/32/1721_2.png) [@borreguero](https://forum.hdfgroup.org/u/borreguero)\
**Post date:** [January 21, 2016, 10:14pm UTC](https://forum.hdfgroup.org/t/h5ltfind-dataset-matches-strings-or-substrings/3663/1 "2016-01-21T22:14:18Z")

</div>

Dear all,

I am querying for the existence of dataset with name "fq" in a file  
containing a dataset with name "fqt", but no dataset with name "fq":  
H5LTfind\_dataset(h5file, "fqt"); //returns 1 as expected  
H5LTfind\_dataset(h5file, "fq"); //returns 1, but should return 0  
H5LTfind\_dataset(h5file, "fq\0"); //returns 1, but should return 0

I assumed from the documentation (  
[https://www.hdfgroup.org/HDF5/doc/HL/RM\_H5LT.html#H5LTfind\_dataset](https://www.hdfgroup.org/HDF5/doc/HL/RM_H5LT.html#H5LTfind_dataset))  
that H5LTfind\_dataset  
returns 1 if and only if a dataset with exactly the same name as my query  
is present in the file. From my results, it seems it returns 1 if my query  
name is a prefix of an existing dataset name

Could anyone please clarify?

Best,  
.Jose

---

<div class="post-metadata">

**Author:** ![j3lamp](https://forum.hdfgroup.org/user_avatar/forum.hdfgroup.org/j3lamp/32/1772_2.png) [@j3lamp](https://forum.hdfgroup.org/u/j3lamp)\
**Post date:** [December 3, 2020, 5:37pm UTC](https://forum.hdfgroup.org/t/h5ltfind-dataset-matches-strings-or-substrings/3663/2 "2020-12-03T17:37:30Z")

</div>

I ran into this same exact problem and was able to work around it by using the `H5LTpath_valid()` function with `true` as the last argument. [https://support.hdfgroup.org/HDF5/doc/HL/RM\_H5LT.html#H5LTpath\_valid](https://support.hdfgroup.org/HDF5/doc/HL/RM_H5LT.html#H5LTpath_valid)

Using your example from above, instead use:  
`H5LTpath_valid(h5file, "fq", 1); // returns 0 as expected!`
