textedit 2.41l-13 - textreplace not working. Thread last updated on 2003-11-11 15:22:25

Posted by member 2112 on 2003-11-10 18:09:45

I'm updating my theme with new versions of most modules. I've upgraded from textedit 2.1l to 2.4l-13. But now my textreplace bangs have stopped working.

I've updated my code so that what was...
*Script exec |textreplace "$ConfigDir$flags.rc" "^(hotspots_on *)1" "\10"

is now...
*Script exec |textreplace @$ConfigDir$flags.rc@ @^(hotspots_on *)1@ @\10@


Is there another change that has been made to textedit that I'm forgetting to include?

Posted by member 36955 on 2003-11-10 21:29:01 link

[Build 11]
...
Backwardly compatible now.
New syntax only used if you specify TextEditNewSyntax (boolean) - default is old syntax (i.e. " ")

Posted by member 2112 on 2003-11-10 22:50:18 link

Thanks doy, but still no luck. Well, maybe a little bit. I tried running the textreplace as a bang through lsxcommand. I found that this code worked...
!textreplace @$ConfigDir$themevars.rc@ @^(DeskTopIconsOn *)true@ @\1false@

... but this did not ...
!textreplace @$ConfigDir$flags.rc@ @^(hotspots_on *)1@ @\10@


Can anyone confirm whether or not textedit handles replacements of integers differently to previous versions?

Posted by member 2112 on 2003-11-10 23:20:39 link

Well I found it.
2.4l Build 13
=============

Changed from use of # to _ due to conflicts.


All my variables use underscores.

Textedit is perhaps the worst example of logical handling of stings I've ever seen.

@ replace "
\= for "
\~ for ;
\@ for @
\/ for \\
\[ for current build number
* was \& but now it's \>
eol $ became # which in turn became _
And with the very latest version I see \- is for _

Am I the only one who thinks this is nuts? Regexp is hard enough without introducing bazaar escape codes that change with every release. AFAIK Java, C++, PHP, MySQL all use the same standard for regexp. Perhaps it is unavoidable for textedit to do it this way.

Posted by member 99 on 2003-11-11 00:38:14 link

I'll bet that 99% of the stuff that textedit is used for could be handled by saving vars with mzscript. It might take a bit more creativity, but I'm almost sure it's probably possible.

but then I've never used textedit...

Posted by member 2112 on 2003-11-11 00:49:13 link

I think I'll explore that option. Thanks, RabidCow.

Posted by member 7223 on 2003-11-11 01:09:11 link

LOL:
!textreplace @$ConfigDir$flags.rc@ @^(hotspots_on *)1@ @\10@

This couldn't work because you have one string (hotspots_on *) associated with \1 and textedit think you want to replace it with an undefined string \10 !!!

Why not simply do:
!textreplace @$ConfigDir$flags.rc@ @^hotspots_on @ @&0@

or
!textreplace @$ConfigDir$flags.rc@ @^hotspots_on *1@ @hotspots_on 0@

Posted by member 36955 on 2003-11-11 15:22:25 link

all of the special characters (like _) can be used by putting a \ in front of them...