Как добавить одинарную кавычку "'" в начале и в конце 5-значного целого числа

28721
Sof

Мне нужно добавить одиночную кавычку в начале и закончить целочисленное поле из 5 позиций в TextPad.

Пример:

14982 14983 14985 14991 14995 15019 

Желаемый результат:

'14982', '14983', '14985', '14991', '14995', '15019' 
3

7 ответов на вопрос

3
Dont

Press F1, the Textpad help provides a very useful hint with examples:

  1. Click Ctrl+R
  2. Text to find: ^.*?$
  3. Replace with: '$0',
  4. Check the "Regular expressions" check-box
  5. Click "Replace All" button.

Wala!

1
Synetech

Just use the search-and-replace function:

  1. Check the regex box
  2. Use \(\d\d\d\d\d\)  as the source (you can also use \(\d\) )—space at the end
  3. Use '\1',  as the target (again a space at the end)
  4. Replace all
  5. Delete the extraneous at the end of the line(s):
    • Manually if there’s a few
    • Using regular expressions if there’s a lot:
      1. Check the regex box
      2. Use , $ as the source
      3. Use an empty field for the replacement text
      4. Replace all

enter image description here

0
Ansgar Wiechers

Replace \(\<[0-9]\\>\) (words consisting of exactly five digits) with '\1', and then ' ' with ', '.

0
Sarah Cao

Два шага: 1. Для первого «» (одинарная кавычка) поместите ^ в текстовое поле «Найти что» и «в текстовое поле« Заменить на ». 2. для вторых «» (одинарная кавычка) и «,» поместите $ в текстовое поле «Найти» и «» в текстовое поле «Заменить на». «D4881», «D2243», «G7051», «X9767», «D3040»,

0
Lazer

Enter ^ in the 'Find what' and ' in the 'Replace with' and Regular expression selected

Enter $ in the 'Find what' and ', in the 'Replace with' and Regular expression selected

Пожалуйста, объясните, чем этот ответ лучше, чем [ответ] (http://superuser.com/a/558430), опубликованный Сарой Цао? DavidPostill 9 лет назад 1
-1
Thomas luu

Более простое решение

  • Найти то, что: (\d)
  • Заменить: '\1',
  • Регулярное выражение: <checked>
  • Заменить все
-1
Jdub

Это хорошо сработало для меня:

Найти: (. +) [\ T] + (. +) [\ T] + (. +) $ Заменить: '\ 1', '\ 2', \ 3 '

Можете ли вы объяснить, что это делает? bertieb 7 лет назад 2

Похожие вопросы