0

I was looking for some help in regards to a csv file that i am trying to upload into a database. The problem I have is that within a csv I have a field of text with quotations and within this text I have a problem where users have added a carriage return (LF) and commas so the database is having some problems in adding the data to the correct fields. What I would like to do, is replace any (LF) within quotations with a space using regular expressions. I have had a look at the following link:

Seeking regex in Notepad++ to search and replace CRLF between two quotation marks ["] only

but the example shown doesnt seem to tackle the problem. If possible can somebody please advise how i can fix this issue.

Thanks in advance.

Community
  • 1
  • 1
mowen10
  • 383
  • 1
  • 12
  • 30

2 Answers2

1

Try this:

Find What:  (\"[^"]*?)(\r\n)([^"]*?\")
Replace With: $1 $3
John Bustos
  • 19,036
  • 17
  • 89
  • 151
  • thanks jorge campos. I forgot to post the sample data, will post it shortly. John Bustos, thanks for your help, I will give that a go and post how i get on. – mowen10 Jan 13 '14 at 18:40
  • "update please ...issue ongoing ...last update on tracker engineers notes, Fault proving hr dis at 80m from customer,(LF) approx distance of cable length to pole, unable to climb(LF) as it is out of date, pole is situated in rear Garden of 13(LF) access arranged with customer for either(LF) after 3pm today(01/02/13) or all day Monday.(LF) test requested ref N please kick to queue ID(LF) ....is this going ahead on monday? thanks", – mowen10 Jan 13 '14 at 21:17
  • the above is an example of the type of text that is within the field, wherever (LF) is indicated, this is where i need to add a space rather than an (LF) so that all the text can than appear on 1 line. hope that helps in regards to what i am trying to do. – mowen10 Jan 13 '14 at 21:20
  • John, I tried and it says 0 occurences were replaced btw, just for my learning what is the replacements supposed to mean $1 $3 – mowen10 Jan 13 '14 at 22:02
  • I tried the exact thing in notepad++ and it worked - MAYBE try removing either the `\r` or `\n` - I'm also working on a better Regex for you, possibly.... – John Bustos Jan 13 '14 at 22:03
0

thanks for all your help. I managed to open the file in Excel and the column that had the (LF) I wrote the formula =CLEAR(cell) and this brought everything into 1 line and when I opened the same file the in Notepad++ the issue was no longer there.

Thanks for taking your time to help me out, really appreciate it.

mowen10
  • 383
  • 1
  • 12
  • 30