|
From: | Jim Ursetto |
Subject: | Re: [Chicken-users] regex to be actively deprecated some day? |
Date: | Wed, 9 Sep 2015 23:24:56 -0500 |
Matt, In fact, there might be a bug in the \1 substitution mechanism, so it is not a bad idea to use the irregex-style replacement anyway, even if you are sticking with POSIX REs. I noticed this a few days ago when attempting to escape characters using a backslash. On the other hand, I could just be doing it wrong. This is correct: #;354> (print (irregex-replace/all "([:@{}>])" "{foo:}" "\\" 1)) \{foo\:\} This is obviously not correct: #;355> (print (string-substitute "([:@{}>])" "\\\\1" "{foo:}" #t)) But, when prefixing the character with something other than backslash, \1 works fine: #;356> (print (string-substitute "([:@{}>])" "^\\1" "{foo:}" #t)) ^{foo^:^} This is with 4.8.0.6 (although I don’t think it matters) and the latest regex. Jim
|
[Prev in Thread] | Current Thread | [Next in Thread] |