6

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'
Alex
  • 1,813
  • 5
  • 20
  • 27
Sof
  • 61
  • 1
  • 1
  • 2

7 Answers7

6

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!

Jason Aller
  • 2,340
  • 6
  • 23
  • 21
Dont
  • 61
  • 1
  • 2
1

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

Synetech
  • 68,243
  • 36
  • 223
  • 356
0

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

Ansgar Wiechers
  • 5,400
  • 2
  • 21
  • 23
0

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',

0

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

Lazer
  • 1
-1

This worked well for me:

Find: (.+)[ \t]+(.+)[ \t]+(.+)$ Replace: '\1','\2',\3'

Jdub
  • 1
-1

Easier solution

  • Find What: (\d{5})
  • Replace with: '\1',
  • Regular Expresion: <checked>
  • Replace all
MoonSire
  • 920
  • 1
  • 8
  • 27