quasarjs

2.1.0 • Public • Published

NPM

Search base_text for matching-all words of search_term, case-insensitive in any order, except treat "words in quotes" as if a single word like in Google search.

Copy as Function Directly into Code

var search_term_is_found = base_text.match(

new RegExp("(?=(.|[\r\n])*" + search_term

.match(/"([^"]+)"|[\w]+/gi)

.join(")((.|[\?=r\n])*")

.replace(/\"/g,'')+")(.|[\r\n])+", "ig")

)!=null

Built Using RegEx Negative Lookaheads (?=

bar(?=bar) finds the 1st bar ("bar" which has "bar" after it)

bar(?!bar) finds the 2nd bar ("bar" which does not have "bar" after it)

(?<=foo)bar finds the 1st bar ("bar" which has "foo" before it)

(?<!foo)bar finds the 2nd bar ("bar" which does not have "foo" before it)

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i quasarjs

      Weekly Downloads

      1

      Version

      2.1.0

      License

      MIT

      Unpacked Size

      1.61 kB

      Total Files

      3

      Last publish

      Collaborators

      • vtempest