how to trim all the [x] enclosed bracket footnotes from a long string of Wikipedia text?

Using this regex \\[[^[a-zA-Z]+] with sed and its -E option in a do shell script command works for me.

Note there is an extra backslash in the regex necessary to escape the other one when used in a do shell script command. In Terminal it would be: \[[^[a-zA-Z]+]

https://regex101.com is a good resource for testing regular expressions.

Example AppleScript code:

set foo to "The three stripes are Adidas' identity mark, having been used on the company's clothing and shoe designs as a marketing aid. The branding, which Adidas bought in 1952 from Finnish sports company Karhu Sports for the equivalent of 1,600 euros and two bottles of whiskey,[7][8] became so successful that Dassler described Adidas as \"The three stripes company\".[7][9]"

set bar to do shell script "sed -E 's|\\[[^[a-zA-Z]+]||g' <<< " & foo's quoted form

Result

"The three stripes are Adidas' identity mark, having been used on the company's clothing and shoe designs as a marketing aid. The branding, which Adidas bought in 1952 from Finnish sports company Karhu Sports for the equivalent of 1,600 euros and two bottles of whiskey, became so successful that Dassler described Adidas as "The three stripes company"."


Notes:

The regex used targets a set of square braces with digits between them. So any combination of e.g. [1] to any number of digits between the square braces will be removed.



enter image description here