Perl-like substitution in S2? Want to make custom HTML tag

Jul 14, 2007 11:48

1. I'm trying to write a function that will do a find-and-replace on the entry text. It would search the entry for foo and replace every instance of foo with bar. Is this even possible ( Read more... )

Leave a comment

Comments 2

camomiletea July 14 2007, 19:04:48 UTC
You can do a search and replace, but you can't use regexes or wildcards. (Although I think I saw someone making an attempt at that too, so maybe it is possible. I just don't remember where the entry was, most likely s2styles.)

Anyway, I use a function created by mageboltrat:

function replace_text(string text, string find, string replacement) : string "Search within \$text and replaces any occurences of \$find with \$replacement ( ... )

Reply

williamw July 15 2007, 18:20:44 UTC
thank you! I'll try some things based on your suggestions.

Reply


Leave a comment

Up