|EolString.replace & escape special chars? [message #482396]
||Wed, 26 August 2009 12:40
Originally posted by: d.clowes.lboro.ac.uk|
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.02271 seconds