Re: GetWords

This WebDNA talk-list message is from

2004


It keeps the original formatting.
numero = 60214
interpreted = N
texte = Here's another possible solution: [grep search=([^?.!]*[?.!]) .*&replace=\1][longblock][/text] There is a space after the ")". Untested, but at least it's shorter! If it has problems, it may be that the sentence end characters in the [] need to be escaped with a "\". It not work as desired if a sentence has e.g. "Mr. Smith" or another abbreviation with a period in it. One possibility is to end sentences with two spaces and to change the space in the search string to have two spaces. Bill -----Original Message----- From: Clint Davis Sent: Mon, 29 Nov 2004 09:55:59 -0600 To: "WebDNA Talk" Subject: Re: GetWords On 11/24/04 8:03 PM, "Joe D'Andrea" wrote: > At 1:34 PM -0600 11/24/04, Clint Davis wrote: >> I need to extract the first sentence out of a block of text. The sentence >> will end with a period, exclamation point, or question mark followed by a >> space. May be a job for [grep]. Any ideas? > > Here ya go: > > [text]ignorewords=no[/text] > > [text]mySentence=[/text] > > [listwords words=This is a sentence with 2.2 children. And this is another > one.&delimiters= ] > > [hideif [ignorewords]=yes] > [!]debug: [index]-[word]-
[/!] > [text]mySentence=[mySentence][word] [/text] > [math show=t]wordlength=[countchars][word][/countchars][/math] > [showif [url][getchars > start=[wordlength]&end=[wordlength]][word][/getchars][/url]=[url].[/url]] > [text]ignorewords=yes[/text] > [/showif] > [showif [url][getchars > start=[wordlength]&end=[wordlength]][word][/getchars][/url]=[url]![/url]] > [text]ignorewords=yes[/text] > [/showif] > [showif [url][getchars > start=[wordlength]&end=[wordlength]][word][/getchars][/url]=[url]?[/url]] > [text]ignorewords=yes[/text] > [/showif] > [/hideif] > [/listwords] > >
> The first sentence is:
> [mySentence] Works! Thanks Joe ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ Associated Messages, from the most recent to the oldest:

    
  1. Re: GetWords ( devaulw@onebox.com 2004)
  2. Re: GetWords ( Joe D'Andrea 2004)
  3. Re: GetWords ( Clint Davis 2004)
  4. Re: GetWords ( Joe D'Andrea 2004)
  5. Re: GetWords ( "WebDna @ Inkblot Media" 2004)
  6. Re: GetWords ( Clint Davis 2004)
  7. Re: GetWords ( Clint Davis 2004)
  8. Re: GetWords ( Joe D'Andrea 2004)
  9. GetWords ( Clint Davis 2004)
Here's another possible solution: [grep search=([^?.!]*[?.!]) .*&replace=\1][longblock][/text] There is a space after the ")". Untested, but at least it's shorter! If it has problems, it may be that the sentence end characters in the [] need to be escaped with a "\". It not work as desired if a sentence has e.g. "Mr. Smith" or another abbreviation with a period in it. One possibility is to end sentences with two spaces and to change the space in the search string to have two spaces. Bill -----Original Message----- From: Clint Davis Sent: Mon, 29 Nov 2004 09:55:59 -0600 To: "WebDNA Talk" Subject: Re: GetWords On 11/24/04 8:03 PM, "Joe D'Andrea" wrote: > At 1:34 PM -0600 11/24/04, Clint Davis wrote: >> I need to extract the first sentence out of a block of text. The sentence >> will end with a period, exclamation point, or question mark followed by a >> space. May be a job for [grep]. Any ideas? > > Here ya go: > > [text]ignorewords=no[/text] > > [text]mySentence=[/text] > > [listwords words=This is a sentence with 2.2 children. And this is another > one.&delimiters= ] > > [hideif [ignorewords]=yes] > [!]debug: [index]-[word]-
[/!] > [text]mySentence=[mySentence][word] [/text] > [math show=t]wordlength=[countchars][word][/countchars][/math] > [showif [url][getchars > start=[wordlength]&end=[wordlength]][word][/getchars][/url]=[url].[/url]] > [text]ignorewords=yes[/text] > [/showif] > [showif [url][getchars > start=[wordlength]&end=[wordlength]][word][/getchars][/url]=[url]![/url]] > [text]ignorewords=yes[/text] > [/showif] > [showif [url][getchars > start=[wordlength]&end=[wordlength]][word][/getchars][/url]=[url]?[/url]] > [text]ignorewords=yes[/text] > [/showif] > [/hideif] > [/listwords] > >
> The first sentence is:
> [mySentence] Works! Thanks Joe ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ ------------------------------------------------------------- This message is sent to you because you are subscribed to the mailing list . To unsubscribe, E-mail to: To switch to the DIGEST mode, E-mail to Web Archive of this list is at: http://webdna.smithmicro.com/ devaulw@onebox.com

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

[WebDNA] Paypal Sandbox TCPConnect (2012) [shell] error? (2005) math on date? (1997) Suffix Mapping (1997) Running _every_ page through WebCat ? (1997) calculating tax rates, mail order solutions and version 2 (1997) [include ...] behavior (1997) Searching multiple Databases (1997) New Weird Behavior (bug report) (2000) [OT] was WebDNA on a Raq4i (2003) RE: Can't get appendfile to work (1997) Shopping cart problem (2003) New Command prefs ... (1997) [format xs] freeze (1997) miva server (2002) read and write you own cookies with webcat (1997) [WebDNA] Webdna error on plain html site - Update (2013) [INCLUDE] Limitations (1998) [WebDNA] Mac Mountain Lion installation (2013) WebCat b15 Mac plug-in (1997)