Welcome Guest

Pages: 1
Remove Wikipedia citation numbers (Regex)
Gary-SwiftPostMay 6, 2024, 08:22
Beginner
Posts: 28
Registered:
April 29, 2014, 06:12
Normal topicRemove Wikipedia citation numbers (Regex)

I was going to ask this as a question but I figured out how to do it so I'm adding my solution here in case it is a help to anyone else.

I was trying to create an action that would remove Wikipedia citation numbers from the comment field.

These are the numbers in square brackets such as [1].

I first did a test to make sure my regex was working over here:

https://regex101.com/

Image

I then added it to the Regular Expression function and assigned it to an action.

This is the regex:

\[[0-9]+\]

The result is shown in the screenshot below:

Image

2MR2PostMay 6, 2024, 10:38
Avatar photo
Administrator
Posts: 2152
Registered:
August 23, 2012, 19:27
Normal topicRemove Wikipedia citation numbers (Regex)

Perfect. Just a hint. The [0-9] sequence can be represented as \d (backslash lower case d)

Personally I can never remember regex sequences. They're available on the context menu or in the Regex tester.

You can go directly into the Regex Tester from the Replace statement by hitting the eyeball button. After creating it in the tester you can save it back to the Replace statement. No need to go out to an external site.

Gary-SwiftPostMay 6, 2024, 16:40
Beginner
Posts: 28
Registered:
April 29, 2014, 06:12
Normal topicRemove Wikipedia citation numbers (Regex)

Great, thanks for the tip!

I also used the built-in tester and it worked great.

Pages: 1
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.034 seconds.