Back references in pattern replace all fails (2)
In yellowgrass, we would like to support references to other issues in WikiText. In order to do this, in issue descriptions and comments, we would like to substitute:
yellowgrass/33by
To do this, we apply the following expression:
/\b([A-Za-z]\w+/\d+)\b/.replaceAll(“\1”, originalText) as WikiTextUnfortunately, the pattern back references in replaceAll (\1) do not work. The pattern fails instead and nothing gets replaced.
Submitted by Sander Vermolen on 19 May 2010 at 14:10
Perhaps this is caused by a separated application of the pattern match and replacement.
Issue Log
On 19 May 2010 at 14:14 Lennart Kats commented:
+1
I really want YellowGrass/23 to work (notice how you can’t click on that link!)
On 4 August 2011 at 17:20 Tillmann Rendel tagged !rendel
On 10 January 2013 at 16:03 Elmer van Chastelet commented:
Just use
$1
?like:
/\b([A-Za-z]\w+\/\d+)\b/.replaceAll("[$1](/issue/$1)", originalText) as WikiText
On 10 January 2013 at 16:03 Elmer van Chastelet closed this issue.
Log in to post comments