Removing all line breaks row by row between quotation mark in notepad++? - replace

I have text file in which I have to remove all line breaks row by row between quotation mark.
how could I do that using notepad++?
great thxs to all.
for example ,raw text is like:
"Acquiror Full
Business Description"
"Acquiror Short
Business Description"
desired format:
"Acquiror Full Business Description"
"Acquiror Short Business Description"

You can use Regex to handle this:
Open Find& Replace Tab:
Enter this in Find Box : ^"(.*)\r\n(.*)"$
Replace with: "$1 $2"
Note: Select Search Mode as Regex.

Related

Slash included words from string

I have a string as follows and I want to have only highlighted text in RegEx:
"Datapath from SF7PCRINFVCR1/MPLS to SF2PCRINFVCR1/MPLS for fwdClass fc_nc is down".
I have tried the RegEx (?<=Datapath from ).*?(?= for) but I am expecting the result as second row under Group Details [attached screenshot] with
Match#2 GroupIndex#1 and GroupContent as SF7PCRINFVCR1/MPLS to SF2PCRINFVCR1/MPLS from the below site as my integration tool is looking for second entry form the Group Details section.
https://www.freeformatter.com/java-regex-tester.html#before-output
Expecting output like

How to replace a pattern in notepad++

I have a sql procedure code. We are migrating the code on different schema. I need to replace all the dimension tables schema.
Example:
Old schemas: DBO.ABC_DIM, DBO.XYZ_DIM
After replace: MART.ABC_DIM, MART.XYZ_DIM
Could any one let me know how we can do this using regex replace.
Thanks
Sky
You must use:
in the "Find what" field:
(DBO)\.
and in the "Replace with" field:
MART\.
Don't forget to place the cursor at beginning of the file. Otherwise the replacements begin after actually cursor position
EDITED:
So in this case if you have others, you can use that:
Find field:
\b(DBO\.)(.+?)_DIM\b
Replace field:
MART\.$2_DIM
Some like:
DBO.ABC_DIM, DBO.XYZ_DIM,
DBO.ABC_DTL, DBO.ABC_2_BCD
become:
MART.ABC_DIM, MART.XYZ_DIM,
DBO.ABC_DTL, DBO.ABC_2_BCD
LAST EDIT:
The above fail with:
DBO.ABC_DIM, DBO.XYZ_DIM,
DBO.ABC_DTL, DBO.ABC_2_BCD, DBO.ABC_DIM, DBO.XYZ_DIM,
DBO.ABC_DTL, DBO.ABC_2_BCD,
DBO.ABC_DIM, DBO.XYZ_DIM,
Because in the second row match DBO.ABC_DTL, DBO.ABC_2_BCD, DBO.ABC_DIM
And DBO.ABC_DTL become MART.ABC_DTL
So the right solution is:
Find field:
(DBO\.)(.[^\.]+?)_DIM
Replace field:
MART\.$2_DIM
see matching results here: http://refiddle.com/refiddles/596b348175622d74ff020000
if you open that schema in VIM, do press esc and then
:s%/DBO/MART
and press enter
:s (colon and s) for substitute
/DBO find DBO
/MART replace it with MART
once you verify that all the DBOs are replace with MART, you need to save the changes by esc and :wq

Finding the ISBN pattern by regexp in Notepad++

I have numerous text files that have book data in which I am trying to extract the International Standard Book Number (ISBN) from. Example snippets:
{" , "classifications": {}, "title": "La casa", "identifiers": {}, "isbn_13": ["978-84-940533-7-5"], "covers": [7281722], "created": {"type": "/type/datetime",
and
"2014-07-28T06:07:52.898549"}, "number_of_pages": 408, "isbn_13": ["9789602354292"],
but how would I go about finding and extracting that ISBN information? Some of the ISBN numbers have dashes, and some do not. Is there a way to replace everything in the text file with a blank except for the snippets that match? I've done research on several similar questions, but having a hard time comprehending it all as I am very new to Notepad++.
Lets say you have your ISBN and some more text in a text file line by line you'd go through following steps:
Make a copy of your text file first!
Open your text file in Notepad++.
Ctrl+H
Search mode: Regular expression
Find what: ^.*?(((1[03])*[ ]*(: ){0,1})*(([0-9Xx][- ]*){13}|([0-9Xx][- ]*){10})).*
Replace with: \1
Click on Replace All
For RegEx please search Google or StackOverflow first. For further information have a look at RegExLib.com, the Internet's first Regular Expression Library.

Need to highlight particular pattern of text

I have a file with some paragraphs, what i want to do is to highlight certain pattern of text/words occurring in the text file with background yellow and text color black.
pattern = ["enough", "too much"];
Text file = "text.txt";
and show it on a webpage with highlighted text for enough and too much words in the text file.
I want to use perl to do this task.
Please tell me how i can do this in optimized way.
Make array of all the words you want to highlight.
Save input file in $file variable.
run foreach on that array and use regular expression to replace the word with word+HTML tag.
ie...
foreach(#words)
{
$file=~r/$/< font color=black, bgcolor=yellow>$< /font>/g;
}
save the $file again as a file with .html or .htm extension.
This was more like logic question than technical i guess.

Find/Replace regex to remove html tags

Using find and replace, what regex would remove the tags surrounding something like this:
<option value="863">Viticulture and Enology</option>
Note: the option value changes to different numbers, but using a regular expression to remove numbers is acceptable
I am still trying to learn but I can't get it to work.
I'm not using it to parse HTML, I have data from one of our company websites that we need in excel, but our designer deleted the original data file and we need it back. I have a list of the options and need to remove the HTML tags, using Notepad++ to find and replace
This works for me Notepad++ 5.8.6 (UNICODE)
search : <option value="\d+">(.*?)</option>
replace : $1
Be sure to select "Regular expression" and ". matches newline"
I have done by using following regular expression:
Find this : <.*?>|</.*?>
and
replace with : \r\n (this for new line)
By using this regular expression (<.*?>|</.*?>) we can easily find value between your HTML tags like below:
I have input:
<otpion value="123">1</option><otpion value="1234">2</option><otpion value="1235">3</option><otpion value="1236">4</option><otpion value="1237">5</option>
I need to find values between options like 1,2,3,4,5
and got below output :
This works perfectly for me:
Select "Regular Expression" in "Find" Mode.
Enter [<].*?> in "Find What" field and leave the "Replace With" field empty.
Note that you need to have version 5.9 of Notepad++ for the ? operator to work.
as found here:
digoCOdigo - strip html tags in notepad++
Something like this would work (as long as you know the format of the HTML won't change):
<option value="(\d+)">(.+)</option>
String s = "<option value=\"863\">Viticulture and Enology</option>";
s.replaceAll ("(<option value=\"[0-9]+\">)([^<]+)</option>", "$2")
res1: java.lang.String = Viticulture and Enology
(Tested with scala, therefore the res1:)
With sed, you would use a little different syntax:
echo '<option value="863">Viticulture and Enology</option>'|sed -re 's|(<option value="[0-9]+">)([^<]+)</option>|\2|'
For notepad++, I don't know the details, but "[0-9]+" should mean 'at least one digit', "[^<]" anything but a opening less-than, multiple times. Masking and backreferences may differ.
Regexes are problematic, if they span multiple lines, or are hidden by a comment, a regex will not recognize it.
However, a lot of html is genereated in a regex-friendly way, always fitting into a line, and never commented out. Or you use it in throwaway code, and can check your input before.