Note that there are some explanatory texts on larger screens.

plurals
  1. POfunction that highlight a word and extract the text near it
    text
    copied!<p>I have a text for example :</p> <blockquote> <p>Etiam porta sem malesuada magna mollis euismod. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Etiam porta sem malesuada magna mollis euismod. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p> <p>Nulla vitae elit libero, a pharetra augue. Vestibulum id ligula porta felis euismod semper. Vestibulum id ligula porta felis euismod semper. Maecenas sed diam eget risus varius blandit sit amet non magna. Vestibulum id ligula porta felis euismod semper. Integer posuere erat a ante venenatis dapibus posuere velit aliquet.</p> <p>Cras mattis <strong>consectetur purus</strong> sit amet fermentum. Etiam porta sem malesuada magna mollis euismod. Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Maecenas faucibus mollis interdum. Nullam quis risus eget urna mollis ornare vel eu leo.</p> </blockquote> <p>That text appears as description on a search performed in my website and i want to be able to highlight a word/string and extract the text next to it.</p> <p>Im not sure is the best way will be php(probably is) or just use a jquery function. I know how to highlight a word in jQuery but not sure how to extract the text.</p> <p>In this example i want to show as description because my searched string is "consectetur purus" the following text.</p> <blockquote> <p>....posuere velit aliquet.Cras mattis <strong>consectetur purus</strong> sit amet fermentum. Etiam porta....</p> </blockquote> <p>As you see im not only showing the highlighted word but also some text before and after it. What would be the best method to accomplish this?</p> <p>Im using the swish-e librari as search engine in my website and my knoledge of cgi is null so i prefer to try the php way.</p> <p>Thanks a lot for all your help</p>
 

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