s-yadav / jsonQ

A JavaScript library to make manipulation and extraction of data from a JSON very easy and fast.
MIT License
202 stars 69 forks source link

Find entries that contain a certain string #23

Open stefaneichert opened 5 years ago

stefaneichert commented 5 years ago

Hi and first of all thanks for the great work on this library! I could not figure out yet if there is a way to find entries that contain a certain string. With the starting letter it works well: var family = jsonQ(myjson); var result = family.find('name', function () { return this[0] == 'f' }); This will of course return all entries that start with an f. Is there a way to use wildcards or such to query entries that contain a certain string e.g. return this == '%xyz%'' and return for example all entries that are like "foo xyz bar", "barfoo xyz" etc...

Thank you very much in advance! Stefan