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

Fast replace

 [1/4] from: kpeters::otaksoft::com at: 7-Aug-2008 19:46


Hi ~ given a series like [ "joe" 155 a-word [ another-word 122 22 "word" "-" [ more-words 122 "' ] ] ] what is a *fast* way to replace all occurrences of "-" with another string? Note that the nesting levels and series composition may vary. Thanks for all suggestions Kai

 [2/4] from: carl:cybercraft at: 8-Aug-2008 16:25


On Thursday, 7-August-2008 at 19:46:11 Kai Peters wrote,
>given a series like >[
<<quoted lines omitted: 3>>
>what is a *fast* way to replace all occurrences of "-" with another string? >Note that the nesting levels and series composition may vary.
This may or may not work depending on context and what the block may hold, but it should be very fast...
>> blk: ["joe" 155 a-word [ word-3 122 22 "word" "-" [ word-4 122 "-"]]]
== ["joe" 155 a-word [word-3 122 22 "word" "-" [word-4 122 "-"]]]
>> blk: load replace/all mold blk "-" "at"
== ["joe" 155 a-word [word-3 122 22 "word" "at" [word-4 122 "at"]]] Alternatively, I'd assume you'd need to recuse through the block, with using parse probably being the fastest way. -- Carl Read.

 [3/4] from: Tom::Conlin::gmail::com at: 7-Aug-2008 23:40


Kai Peters wrote:
> Hi ~ > given a series like
<<quoted lines omitted: 6>>
> Thanks for all suggestions > Kai
rule: [any[into rule |["-" here: (change back :here "foo")]| skip]] parse blk rule

 [4/4] from: kpeters::otaksoft::com at: 8-Aug-2008 9:34


Thanks to both of you - very much appreciated! Kai

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