Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Rebol "Find/whole" suggestion

 [1/5] from: tbrownell:shaw:ca at: 7-Mar-2002 23:51


Here's one feature I could use.. Find/whole n: "This is a bookmark" find/whole n "book" ==false TBrownell

 [2/5] from: greggirwin:mindspring at: 8-Mar-2002 10:15


hi Terry, << Here's one feature I could use.. Find/whole n: "This is a bookmark" find/whole n "book" ==false >> How about something like:
>> find parse n none "book"
== none --Gregg

 [3/5] from: tbrownell:shaw:ca at: 8-Mar-2002 10:15


Aye, that works, but then requires parsing n, perhaps for the second time, which can be slow, especially on really really big docs. I prefer inserting and appending a space to the word... a: "book" insert a " " append a " " n: "This is a bookmark" find n a == none Just thought this would make a nice addition to "Find"... "Find/whole". Text editors have a "Find whole words" ability... so should Rebol. TBrownell

 [4/5] from: hallvard:ystad:helpinhand at: 8-Mar-2002 21:41


Dixit Terry Brownell (19.15 08.03.2002):
>Aye, that works, but then requires parsing n, perhaps for the second time, >which can be slow, especially on really really big docs. I prefer inserting
<<quoted lines omitted: 4>>
>find n a >== none
Well, but: nn: "But this is a book; this is yet another book, and finally, this is a book" a: "book" insert a " " append a " " find nn a == none So you probably shouldn't add spaces, but parse with a charset! that's the complement of all letters that may constitute a word. And finally check if the string starts or ends with the word you're looking for. ~H

 [5/5] from: al::bri::xtra::co::nz at: 9-Mar-2002 9:44


What's wrong with just using:
>> find "This is a bookmark in a book of writing" " book "
== " book of writing" In other words, just put a space before and after the search item? Or if you're using more complex text, something like:
>> parse/all Text [any [[[#" " | #"^/"] mark: "book" end: [#" " | #"^/"]]
(print copy/part Mark End) | skip] end] book == true Andrew Martin ICQ: 26227169 http://valley.150m.com/

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted