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 am trying to do a find and replace in Notepad++ I have a file that has an open bracket a number and a comma I want to replace the number leaving the value null Ex: Find: "(32," Repalce with: "(''," The numbers range from two to four digits. I have done it before in BBEdit, but do not have access to it on this computer. can I do this in Notepad++? Thanks

share|improve this question
    
Do you want the number replace with 2 single quotes? – MacAnthony Jul 23 '12 at 20:49

I used this to get it to work. This assumes that something other than a digit will follow the replaced number (like a comma or a space).

Find what:

\(\d+

Replace with:

(''
share|improve this answer
    
His question indicated that he needs the range of numbers to be between 2 and 4, which this solution does not account for. – Matt Ramey Jul 23 '12 at 21:05
    
Actually, he said that the numbers range from 2 to 4 but not that there may be values out of that range that shouldn't match. If all the numbers are between 2-4 and he wants to do this to all of them, then this still meets that need. – MacAnthony Jul 23 '12 at 21:08
    
@MattRamey If that's truly a need, then yours is better. I'm only offering this as this is an easier solution to remember. – MacAnthony Jul 23 '12 at 21:10

You're going to want to use the following regex for the search term:

\((\d{2,4}),

And select "regular expression" option.

share|improve this answer
    
I tried this first but I couldn't get notepad++ to work with a range modifier. Which version of notepad++ is this? I may have an outdated version. – MacAnthony Jul 23 '12 at 21:12
    
Notepad++ recently added regex range modifiers. I'm not sure of the exact version, but my current version of 6.15 is working with it. – Matt Ramey Jul 23 '12 at 22:01
    
Yes, my version was 5.8.2 so this solution may be very version dependent. I should probably update it. – MacAnthony Jul 24 '12 at 12:54

You must log in to answer this question.

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