Notepad++ :: Remove All Lines And Text That NOT Contains - text

Title is pretty much self explanatory...
My regex is still not perfect but I need to solve 2 issues before I improve it...
I can get all lines with ip:port but I don't know how to :
remove the rest of the text WITHIN that line.
Replace the empty lines \r\n\ with nothing AT THE SAME REGEX REQUEST.
That a sample of text file :
junk text junk text junk text junk text junk text junk text junk text
junk text 127.0.0.1:28 junk text junk text junk text junk text junk text
junk text junk text junk text junk 127.0.0.1:28text junk text
junk text junk text junk text 127.0.0.1:28 junk text
junk text junk text junk text
junk text 127.0.0.1:28 junk text
junk text
junk text 127.0.0.1:28 junk text
junk text 127.0.0.1:28 junk text junk text
junk text junk text junk text 127.0.0.1:28 junk text
junk text junk text junk text junk text junk text
junk text junk text junk text 127.0.0.1:28 junk text junk text junk text
junk text junk text 127.0.0.1:28 junk text junk text junk text junk text junk text
I'm expecting to get back :
127.0.0.1:28
127.0.0.1:28
127.0.0.1:28
127.0.0.1:28
127.0.0.1:28
127.0.0.1:28
127.0.0.1:28
127.0.0.1:28
127.0.0.1:28
Obviously that example uses that same ip:port line but I don't want it to be fixed value.
Is it possible to do it with 1 single regex request?
...Just as a starting point I tried :
^(?!.*[09].*).+$

You may match and capture an IP with (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+) and then you may match any text that does not start an IP like substring with a (?:(?!\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+).)* tempered greedy token.
Find What: (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+)|(?:(?!\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}:\d+).)*
If you add (?s) at the pattern start, you will not have to check the . matches newlines option.
To replace with just the IPs found and adding the line break can be done using a conditional replacement pattern:
(?{1}$1\n:)
It will replace the match with Group 1 value (IP) if it matched + a line break, else, the match will be replaced with an empty string.

Related

How to add line break to text field in NetSuite

I have the MEMO field of sales order pulled into the printed invoice (PDF). I want the string of the memo field to be split in multiple lines on the document.
MEMO "Line1 Line2" should result in
Line1
Line2
in the PDF
I tried "Line1\nLine", "Line1Line" with all combination of quotes and escape backslashes. Wihtout luck.
If you need line break on Advance PDF use the HTML tag <br/> or <br>.
If your Memo field contains \n you can replace it with <br/> in the advanced PDF using the following function
${memo?replace("\n", "<br/>")}

How do I start the index to a different position in a text file?

What I am trying to accomplish is to extract specific text from a text file.
Currently what this code outputs is that if parsed, it will display extracted text in a messagebox. It will extract the first 500 characters from the text file and display it in a little messagebox.
The problem is that it starts from the beginning of the text file to extract the text. What I want it to do is to search for the text that states "SUMMARY" in the text file and start from there to extract the first 500 characters.
I believe the problem is that I am missing some necessary code and I'm hoping someone can help me provide it for me please.
Dim start_index As String = "SUMMARY"
If parse() Then
MsgBox(tariff.Substring(0, 500))
Else
MsgBox("Failed to parse.")
End If

What options are there to process text which was extracted from pdf to remove text wrapping / justified effect

I have been able to extract text from multiple pdf files but the original files had double line spacing within 1 column of text which was wrapped or justified so my extracted text also has alot of CR LF within. My issue is when the text wraps sentences also contain CR LF
toy example
This sentence continues
on this line. Next ....
I don't want to loose all the spacing structure like paragraphs so is there a way to unwrap (un-justify) text using python without removing all spacing in the document or intelligently join the lines back?
Eventually I want to spell check the text with Spacy after additional text processing to handle non english text but the justified/wrapped text may be causing misspellings and difficultly detecting all the non english text.

Paste different lines of text to existing lines of text using Notepad++

I'm trying to add/paste different lines of text to existing lines of text via notepad++.
I have a text file with a list of towns/cities and I need to add a comma and then longitude and latitude values after the town/city name like this:
Preston,55.8091,-2.3364
Reston,55.85201,-2.1973
Sinclair's Hill,55.74975,-2.29538
St Abbs,55.89951,-2.13229
How is this done? I can do this for identical text by using replace $ and replace with. But this only works for identical text.

Preformatted text in SSRS

How do I achieve the effect of preformated text in SSRS?
For example, this is what I see,
First Line of text
Second line of text
Third line of text
But I would like to see
First Line of text
Second line of text
Third line of text
The problem is obviously the leading spaces that I used in every line to indent the lines themselves. When those lines are rendered in SSRS (which is web based), the consecutive whitespaces are ignored.

Resources