Page MenuHomePhabricator

[Migrated] More features in the replace expression
Open, LowestPublicFeature

Description

The replace expression seems to have very limited possibilities/features. I would like for example the possibility to change $1 from upper-case to lower-case and vice versa. It would also be useful with for example \n, \u or \x that only can be used in the find expression for the moment. @Svensson1 19:54, 14 December 2013 (UTC)

Related Objects

Event Timeline

Reguyla raised the priority of this task from to Needs Triage.
Reguyla updated the task description. (Show Details)
Reguyla added a project: AutoWikiBrowser.
Reguyla moved this task to Feature request (unsorted) on the AutoWikiBrowser board.
Reguyla added subscribers: Reguyla, Aklapper.

@John_of_Reading 20:11, 14 December 2013 (UTC) wrote:
There is a workaround using some of the MediaWiki builtin functions. Something like {{subst:lc:$1}} should convert $1 to lowercase, for example. But this won't work well if you have ticked "Add replacements to edit summary", since "subst" doesn't work in edit summaries.

@GoingBatty 18:38, 15 December 2013 (UTC) wrote:
@Svensson1 \n can be used in both find and replace. Could you please provide more information on how you're trying to use it?

@Svensson1 14:24, 22 December 2013 (UTC) wrote:
I just want the possibility to do a replace like this: "$1\n$2". But it is not extremly important for me and you say that it already works (at least outside the Regex tester), so maybe nothing needs to be done concerning \n. The two other I mentioned, \u and \x, is not so important for me for the moment.

@GoingBatty 14:19, 16 December 2013 (UTC) wrote:
@John of Reading Substituting also doesn't work within {{tag|ref}} tags, so doing something lik changing months from "november" to "November" and "january" to "January" each have to be spelled out in different regex replacements.

@Mandarax 20:43, 15 December 2013 (UTC) wrote:
I suspect there was confusion about \n because it does ''not'' work for replacements in the Regex Tester – it displays the text "\n" rather than the desired effect of a new line. It would be great if there was a way to get it to work there.

@GoingBatty 14:16, 16 December 2013 (UTC) wrote:
@Mandarax - If I remember correctly, you need to check one of the boxes in the Regex tester to get it to work, but don't need to check the corresponding box in the Find and replace screen to get it to work there. I'll look in to that further later.

@Mandarax 04:30, 18 December 2013 (UTC) wrote:
As far as I know, there's nothing a user can do to make this work correctly in the Tester. When I first encountered this problem long, long ago, I assumed that the Tester was a tool which accurately mirrored what happens with the actual Find and replace, but I eventually discovered that that is not the case for \n.

@GoingBatty 15:18, 22 December 2013 (UTC) wrote:
I reviewed the archived bug reports, and don't see the exact issue being discussed here, so I've opened a new bug report.

@GoingBatty 15:18, 22 December 2013 (UTC) wrote:
Also, substituting within {{tag|ref}} seems possible if you combine parser functions (e.g. {{subst:lc:$1}} inside {{subst:#tag|ref}}) - I look forward to playing around with this.

@Technical_13 00:11, 23 December 2013 (UTC) wrote:
See https://en.wikipedia.org/wiki/User talk:Technical_13#Substituting_templates inside_references for more details on the workaround for this if interested.

Aklapper changed the subtype of this task from "Task" to "Feature Request".Nov 22 2022, 5:19 PM