|EolString.replace & escape special chars? [message #579587]
||Wed, 26 August 2009 12:40
Registered: September 2009
I believe I am correct in saying that the source string of the replace |
operation is a regular expression. As such can anyone explain what I am
doing wrong here:
I have a string say "children.1children.2children.1" and I want to convert
it to "c1c2c1". I wrote simply:
t := s.replace('children\.','c');
\ as . is special regex character.
However I get an problems shown in the in window (preventing a build)
saying "no viable alternative at input".
I tried below and it does not work as I assume the regex is wrong
t := s.replace('children\\.','c');
t := s.replace('children','c'); works but I want to remove the . as well
Anyone have ideas?
Powered by FUDForum
. Page generated in 0.03264 seconds