Link to home
Start Free TrialLog in
Avatar of PraveenKumarGautam
PraveenKumarGautam

asked on

Regular Expression (Find and Replace)

Hi,

In one of my file I have the data as below

04001-AP107-6718,2005,"5,939",0,0,"5,939","6,117","2,630",10.52,

here I would like to replace "5,939" with "5939".

Please suggest a way out.
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

You don't even need a regex for that:
line = line.replace("5,939", "5939");

Open in new window

Avatar of PraveenKumarGautam
PraveenKumarGautam

ASKER

I need a regular expression that can work in Notepad++ for this data
I just want to do the similar find and replace(as mentioned in the question) in the whole file
Notepad really works in this way withou problems - you put the Find box "5,939" in the replace box: "5939" and replace all will work
Do you mean you want to follow the general pattern als replacing "6,110" with "6110", etc - ?
Yes I am looking for a general pattern
Try
String PAT = "(\"\\d+),(\\d+\")";
line = line.replaceAll(PAT, "$1$2");

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I tried the same in Notepad++ but it is replacing the numbers with $1$2 rather then the desired results
It would be more like what i posted here http:#35218809
:)