Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h1>Assumptions</h1> <ul> <li>Sentence must start with a <strong>capital</strong> letter with no line terminators [.?!] in between.</li> <li>Keyword match is case insensitive. A sub-string match is not valid though.</li> <li>Keywords may appear anywhere in (start, end or in the middle of) the sentence.</li> <li>Supports quotations and <strong>informal</strong> double punctuation. Use the second regex if not required.</li> </ul> <p></p> <pre><code>public class SentenceFinder { public static void main(String[] args) { String paragraph = "I have a list of words to match: dog, cat, leopard. But blackdog or catwoman shouldn't match. Dog may bark at the start! Is that meow at the end my cat? Some bonus sentence matches shouldn't hurt. My dog gets jumpy at times and behaves super excited!! My cat sees my goofy dog and thinks WTF?! Leopard likes to quote, \"I'm telling you these Lions suck bro!\" Sometimes the dog asks too, \"Cat got your tongue?!\""; Pattern p = Pattern.compile("([A-Z][^.?!]*?)?(?&lt;!\\w)(?i)(dog|cat|leopard)(?!\\w)[^.?!]*?[.?!]{1,2}\"?"); Matcher m = p.matcher(paragraph); while (m.find()) { System.out.println(m.group()); } } /* Output: I have a list of words to match: dog, cat, leopard. Dog may bark at the start! Is that meow at the end my cat? My dog gets jumpy at times and behaves super excited!! My cat sees my goofy dog and thinks WTF?! Leopard likes to quote, "I'm telling you these Lions suck bro!" Sometimes the dog asks too, "Cat got your tongue?!" */ } </code></pre> <p><br /> Simplified regex if "Quotes?!" (or informal punctuation) isn't required:<br /> <code>"([A-Z][^.?!]*?)?(?&lt;!\\w)(?i)(dog|cat|leopard)(?!\\w)[^.?!]*?[.?!]"</code></p> <p>To fetch those sentences as well that don't start with a capital letter (if the input may have such typos):<br /> <code>"(?i)([a-z][^.?!]*?)?(?&lt;!\\w)(dog|cat|leopard)(?!\\w)[^.?!]*?[.?!]"</code></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload