regexp to replace LF within quotations - regex

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.

Try this:
Find What: (\"[^"]*?)(\r\n)([^"]*?\")
Replace With: $1 $3

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.

Related

Sublime Text Regex Replace and Append

Can someone please help me with a regular expression.
I'm having trouble with even the start as I'm a regex absolute beginner and the tutorials aren't really helping as I'm not understanding it.
I've got a large amount of files with things like 'products.htmlcar' or 'products.htmlcar_paper' or 'products.htmlhome-decorative_air_freshener'
I'm trying to remove all instances in all my files of the words "'products.html" and replace them with just the text at the end of it and append html to it before the ending " ' " for example 'products.htmlcar' becomes 'car.html' or 'products.htmlhome-decorative_air_freshener' becomes 'home-decorative_air_freshener.html'
I have tried to do a few of the things I checked out like
\^'products.html
but sublime text is not searching for this correctly. I don't know whether my syntax is incorrect or something but it's really confusing me.
Thanks in advance.
Try this:
Find: products\.html(.*?)'
Replace: $1.html'
Use this if your strings are
products.htmlcar
products.htmlcar_paper
products.htmlhome-decorative_air-freshener
^products.html
if your strings have ' a
^'products.html

SublimeText: How do I use regex to find dynamic content in a string?

I'm currently cleaning up an XML file manually and removing unnecessary content and tags. It would help hugely if I could find all instances of a tag with its dynamic content and remove it with SublimeText Regex. How do I do this?
This is the tag that needs to be found. The content within the quotes is dynamic, which means I can't do simple find replace:
[simple_tooltip content='Colour Printer']
Is there a regex syntax that can help me kill the content within the quotes?
I've Googled a bit and haven't been able to find a clear way of doing this. However, regex is also confusing... Any help is greatly appreciated. Thanks
I don't use Sublime so this may be a little off, but I think you're looking for something like this?
Find content='.+?' Replace content=''
Explanation
Match content=' literally
Match . (any character) + (1 or more times) ? (lazily)
Match ' literally

Regex Find and Replace using line numbers condition in editplus

I have a huge text file with over 20K lines of content. I am using editplus 4.0 version to achieve my desired result.
What I want to do is;
I want to insert/append a keyword, randomly in the content. Now, the condition is, I want to insert my keyword once for every 60 lines.
If I achieve this, next I have another app which can split my huge content into multiple lines based on line count, which is 60 in this case.
So, end of the day I will have my content into multiple text files and every file includes my keyword which I am going to use it for blog posting.
Please suggest me if I can do this with editplus, other ways of achieving the same will also welcome.
I tried lot of options but no luck.
Thanks in advance !!
AFAIK editplus doesn't work with regex.
I suggest you to use Notepad++, with it you can do:
Ctrl+H
Find what: ((?:[^\r\n]*\R){60})
Replace with: $1KEYWORD\n
Replace all
Don't forget to select Regular expression in search mode.

NotePad++ RegEx for pulling text between two tags?

Fellow Forum Members,
Can someone please help develop a RegEx that is able to search for text that resides within an opening and closing tag? The example below illustrates it better. "para" is in the closing and opening tag and the data I need to pull is in between these two tags.
<para>Text I would like to see in the NotePad++ Search Result Hit List</para>
What RegEx can perform such as task? Any help will be greatly appreciated. Thanks in advance.
Try this expression:
(?<=<para>)[\s\S]*?(?=<\/para>)

regex to remove hyperlinks

Input:
source http://www.emaxhealth.com/1275/misdiagnosing from here http://www.cancerresearchuk.org/about-cancer/type recounting her experiences and thoughts blog http://fty720.blogspot.com even carried the new name. She was far from home.
From the about input I want to remove the hyperlinks. Below is the regex that I am trying
http://[\w|\W|\d|\s]*(?=[ ])
This regex will encompass all characters,digits and whitespaces after encountering the word 'http' and will continue till first blank space.
Unfortunately, it is not working as expected. Please do help me find out my error.Thanks
Try this sed command
sed 's/http[^ ]\+//g' FileName
Output :
source from here recounting her experiences and thoughts blog even carried the new name. She was far from home.
To find the hyperlink use:
\b(https?)://[A-Z0-9+&##/%?=~_|$!:,.;-]*[A-Z0-9+&##/%=~_|$]
or:
If you want to find the html a tag use:
<a\b[^>]*>(.*?)</a>