Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to add a single quote at the begining and end to a 5 position integer field in TextPad.

Ex:

14982
14983
14985
14991
14995
15019

Desired result:

'14982',
'14983',
'14985',
'14991',
'14995',
'15019'
share|improve this question

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{5}\) )—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

share|improve this answer

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!

share|improve this answer

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

share|improve this answer

Two steps: 1.For the first "'" (single quote), put ^ on Find What text box and ' on the Replace with text box. 2. for the second "'" (single quote) and ", " , put $ on Find What text box and ' , on the Replace with text box. 'D4881', 'D2243', 'G7051', 'X9767', 'D3040',

share|improve this answer

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

share|improve this answer
1  
Please explain how this answer is better than the answer posted by Sarah Cao? – DavidPostill Oct 9 '14 at 19:16

Easier solution

  • Find What: (\d{5})
  • Replace with: '\1',
  • Regular Expresion: <checked>
  • Replace all
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .