1

I need to find and replace the text [n] with the text \textsuperscript{n}.

Where n is a number between 1-99.

EG. the text [15] with the text \textsuperscript{15}

I am not a programmer but think grep is my friend here.

I have tried: Find: \[\d+\] Replace: \\textsuperscript{\d+} this finds the numbers but replaces them with \textsuperscript{\d+} (predictably).

Where am I going wrong please?

Thanks for your help. Found the solution over on Google Groups for Textwrangler. Apparently I needed a subpattern.

Find: \[(\d+)\]

Repalce: \\textsuperscript\{\1}

Here is a link to the Solution

Robert
  • 11
  • 1
  • 3
  • I don't know textwrangler, but something like `find: \[(\d+)\]` and `replace: textsuperscript{$1}` should work. Or `\1` instead of `$1` – Toto Oct 23 '17 at 09:50
  • Thanks, but sadly it didn't work. Just faithfully replaces with no number, tried a lot of different combinations of your suggestions. – Robert Oct 23 '17 at 13:22
  • Strange. According to documentation it accepts PCRE syntax for regex. Did you check `Use Grep`? – Toto Oct 23 '17 at 15:21
  • I did use grep for my searches. As this is solved I am wondering how I report this question as solved please? – Robert Oct 24 '17 at 13:52
  • Answer the question below and mark it as accepted. – Toto Oct 24 '17 at 14:47

1 Answers1

0

Thanks for your help. Found the solution over on Google Groups for Textwrangler. Apparently I needed a subpattern.

Find: \[(\d+)\]

Repalce: \\textsuperscript\{\1}

Here is a link to the Solution

Robert
  • 11
  • 1
  • 3