- May
- 13,802
- 211
I discovered that the Oniguruma library that TCC uses allows for up to 32 captures which might later be used in substitutions (as @XREPLACE does). Gnu sed, for example allows only the back-references \0 to \9.
As it stands (I think) @XREPLACE allows \0 to \31 but this leaves the problem of how to interpret, say, \10 in a replacement string ... should it insert capture number 10 or capture number 1 followed by a 0? As it stands, @XREPLACE substitutes capture number 10.
I am tempted to allow only \0 to \9 (as @XREPLACE's documentation already says) and avoid the ambiguity mentioned above and be more like sed.
Any thoughts?
As it stands (I think) @XREPLACE allows \0 to \31 but this leaves the problem of how to interpret, say, \10 in a replacement string ... should it insert capture number 10 or capture number 1 followed by a 0? As it stands, @XREPLACE substitutes capture number 10.
I am tempted to allow only \0 to \9 (as @XREPLACE's documentation already says) and avoid the ambiguity mentioned above and be more like sed.
Any thoughts?