I'm trying to find a list of Strings in a file (already formated from \n and \r), for example :
0145100841
65722ED01A
657738J000
6584640F00 // this one is found
in a file of this :
201506186584640F00AME NMGR01 RUBAT
How can i do this in Notepad++ ? Is there an existing plugin ?
Prolog
To help people coming from the search or Google, I write it again as answer. Please mark it as correct answer to improve the speed of finding the correct answer.
You can also check the comment section inside the question if something is unclear.
Solution
Instead of seperating the search terms by \r a possible solution would be seperating them by | Pipe symbol, so you can use the whole string as an Regular Expression.
Search Term: 0145100841|65722ED01A|657738J000|6584640F00
You can now press CTRL + F (or in Germany STRG + F) to open the "Search"-Window.
Now you have to change the "Search Mode" to "Regular Expression" and insert the search term.
If you now press search you will get one match (if one exists) and with every continued press, you will get another match (if one exists).
You can test this with following random text content.
Following the Pastebin: http://pastebin.com/YB3i1Ju0
To remove the dependency on pastebin, here the random text content pasted as blockquote:
RANDOM TEXT CONTENT
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat6584640F00, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.Lorem657738J000 ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, n65722ED01Ao sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetet0145100841ur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
Related
I am a very beginner in Pug and I'm trying to solve the following task: Every occurrence (in text) of the following words shall become a link to the destination defined below:
sed -> https://google.com
liq -> https://facebook.com
Đ¢his works as I expected, but keeps anchor tag as string.
- var str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar elementum integer sed neque volutpat ac. Facilisis liq odio morbi quis commodo odio aenean . Vel facilisis volutpat liq velit. Viverra aliquet liq sit amet tellus cras adipiscing sed.";
- var url = '#[a(href="https://google.com") sed]'; //I tried with these ones too - var url = 'sed'; var url = 'a(href="https://google.com)sed'
- var res = str.replace(/sed/g, url);
p #{res}
Here my latest atempt:
mixin link(href, name)
a(href=href target!=attributes.target )= name
//+link('https://google.com', 'Google')(target="blank")
- var str = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Pulvinar elementum integer sed neque volutpat ac. Facilisis liq odio morbi quis commodo odio aenean . Vel facilisis volutpat liq velit. Viverra aliquet liq sit amet tellus cras adipiscing sed.";
- var link = +link('https://google.com', 'Google')(target="blank");
- var res = str.replace(/sed/g, link);
p #{res}
I've never seen Pug mixins used within javascript code blocks like that before. I'm surprised it even outputs the anchor tag at all.
That being said, you can use the unescaped string interpolation syntax (!{variable}) instead of the regular string interpolation syntax (#{variable}) to get the link to render as a link.
In your case:
p !{res}
But keep in mind this word of warning from the Pug documentation:
Caution
Keep in mind that buffering unescaped content into your templates can be mighty risky if that content comes fresh from your users. Never trust user input!
I am working on text files (copied and pasted from a facebook group) I have stripped out all the strings "Like" "Comment" comment numbers etc with group of sed commands . I am left with lines that look like this:
Jane Doe
Jane Doe Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Donec ac urna ut quam sagittis placerat id vitae justo.
John Doe
John Doe Maecenas id justo tempus, auctor velit in, porta nibh.
John Doe
John Doe Maecenas id justo tempus, auctor velit in, porta nibh.
Fred Crun
Fred Crun Maecenas id justo tempus, auctor velit in, porta nibh. Mauris bibendum et ligula molestie faucibus. Nullam feugiat tristique sapien non fringilla.
Fred Crun
Fred Crun Maecenas id justo tempus, auctor velit in, porta nibh. Mauris bibendum et ligula molestie faucibus. Nullam feugiat tristique sapien non fringilla.
Frank Zappa
Frank Zappa Suspendisse malesuada libero id tortor scelerisque feugiat. Suspendisse vel feugiat est. Vestibulum vel nisl magna. Aenean viverra diam vel vulputate pulvinar. In hac habitasse platea dictumst.
I am looking for a regexp for sed or other Unix utility that would remove the name on the line(s) with no other text following, leaving the lines looking like this:
Jane Doe Lorem ipsum dolor sit amet, consectetur adipiscing elit.
John Doe Maecenas id justo tempus, auctor velit in, porta nibh.
John Doe Maecenas id justo tempus, auctor velit in, porta nibh.
Fred Crun Maecenas id justo tempus, auctor velit in, porta nibh. Mauris bibendum et ligula molestie faucibus. Nullam feugiat tristique sapien non fringilla
Fred Crun Maecenas id justo tempus, auctor velit in, porta nibh. Mauris bibendum et ligula molestie faucibus. Nullam feugiat tristique sapien non fringilla.
Frank Zappa Suspendisse malesuada libero id tortor scelerisque feugiat. Suspendisse vel feugiat est. Vestibulum vel nisl magna. Aenean viverra diam vel vulputate pulvinar. In hac habitasse platea dictumst.
ode here.
. I looked at uniq and several examples of regep in gvim but I could not see a way to achieve my aim . Names may consist of 3 words.
This might work for you (GNU sed):
sed -E 'N;/^(.*)\n\1./!P;D' file
Open a two line window throughout the length of the file.
If the whole of the first line is the same as the start of the second, do not print it.
Delete the first line and repeat.
In Vim you can do the following:
:%s/^\(.*\)\n\1/\1
Which looks for a line, followed by \n and the same line (plus potentially something after, it is not specified) and replaces it with the pattern found, removing the first part.
if your data in d file, tried on gnu sed:
sed -E '/^\w+\s\w+\s*$/{N;s/([^\n]+)\n(\1.+)/\2/;b};d' d
This is my problem:
So, I want to select just a part of one (usually very long) line, and when I only slightly move my mouse down while moving to the right, the next line gets selected, and I can start over again.
Does anyone have a solution for this annoying mouse behavior?
Or would you recommend an altogether different input method? (pen, touch pad, keyboard, etc.)
Click on the start point of the text you want, then with the SHIFT key held down, click on the end point.
That's by design.
If you only wish to mark a part of one line, move mouse left-right only, not down (or up).
There are many possibilities to target your problem.
You can use your Shift-Key and the cursor keys to select.
You can also use your Shift-Key in combination with your End-Key and or Pos1-Key
You can also use your Shift-Key in combination with your mouse like mentioned by another user
Also the problem is not that big when you make shorter lines. In VBA you can use _ to hang lines together and interpret it like one:
txt = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
is the same as
txt = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, " _
& "sed diam nonumy eirmod tempor invidunt ut labore et " _
& "dolore magna aliquyam erat, sed diam voluptua. At vero " _
& "eos et accusam et justo duo dolores et ea rebum. Stet " _
& "clita kasd gubergren, no sea takimata sanctus est Lorem " _
& "ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur " _
& "sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut " _
& "labore et dolore magna aliquyam erat, sed diam voluptua. At " _
& "vero eos et accusam et justo duo dolores et ea rebum. Stet " _
& "clita kasd gubergren, no sea takimata sanctus est Lorem ipsum " _
& "dolor sit amet."
To select the whole line you can also click at the white space between the gray bar on the left side of the editor and the first sign in the editor
I hope that helps you.
I was wondering if it would be possible to run the vim spell checker while coding with PHP.
I can run it if I disable syntax highlighting, and it highlights almost all methods/function names because they are not English words.
So, my question is this, can I run the spell check on just the strings within PHP files?
For example, just within the ' quotes (and " quotes), ignoring everything else:
$paragraph = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. In est libero, dictum ut suscipit eget, lacinia in justo. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Praesent sit amet sem libero, in pretium enim. Pellentesque tortor ante, imperdiet quis mattis in, tincidunt et ligula. Cras porta velit a ligula venenatis placerat.';
$paragraph2 = "Vestibulum quis eleifend lectus. Vestibulum odio odio, mollis at eleifend a, adipiscing sed quam. Nam quis nisi quis mauris faucibus hendrerit eu a leo. Sed feugiat purus sit amet purus congue quis semper diam malesuada. Vivamus et enim non arcu pretium sollicitudin. Nullam blandit, lorem eu aliquet tincidunt, enim mauris placerat lectus, id faucibus nulla lectus non elit. Sed eget fermentum lacus. Ut tempus pulvinar neque, vel pellentesque purus aliquet quis. Vivamus molestie pretium quam at imperdiet. Maecenas diam turpis, malesuada ut sollicitudin ac, congue eleifend urna. Quisque id ipsum eget ipsum tempus blandit at vel magna. Fusce eu felis metus.";
see the vim help: :help spell-syntax
You can define particular syntax groups as having spell checking.
There's probably a better way to do it (using a ~/.vim/after/syntax/php.vim file?), but a simple hack is to make a personal version of the php syntax file in ~/.vim/syntax (you can do this by doing :e $VIMRUNTIME/syntax/php.vim and the :saveas ~/.vim/syntax/php.vim), and change all instances of the text contains=#phpAddStrings to contains=#Spell,#phpAddStrings. Next time you open a php file, turn on spell checking as normal with :set spell.
For the life of me, I cannot figure out the cause of this: when writing in LaTeX documents, I like to keep my line width to maximum of 80 characters. As such, I will execute the vim command gqap and vim will automatically re-wordwrap the paragraph I am writing.
For example, it will cause a long line to become many shorter ones:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque pharetra nunc eget arcu dapibus pretium. Nulla vel risus quam, ut sollicitudin sem. Vivamus vitae diam in risus pharetra gravida. Donec rutrum mattis nulla, in consectetur lorem luctus varius. Donec augue purus, iaculis eget fringilla nec, vehicula ut sapien. Quisque sit amet dolor mauris. Sed ac est eu ligula aliquam tincidunt. Proin condimentum rutrum lacinia.
becomes:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque pharetra
nunc eget arcu dapibus pretium. Nulla vel risus quam, ut sollicitudin sem.
Vivamus vitae diam in risus pharetra gravida. Donec rutrum mattis nulla, in
consectetur lorem luctus varius. Donec augue purus, iaculis eget fringilla nec,
vehicula ut sapien. Quisque sit amet dolor mauris. Sed ac est eu ligula aliquam
tincidunt. Proin condimentum rutrum lacini
But, for some paragraphs, it will start adding unusual indentions towards the end of the paragraph:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque pharetra
nunc eget arcu dapibus pretium. Nulla vel risus quam, ut sollicitudin sem.
Vivamus vitae diam in risus pharetra gravida. Donec rutrum mattis nulla, in
consectetur lorem luctus varius. Donec augue purus, iaculis eget fringilla,
vehicula ut sapien. Quisque sit amet dolor mauris. Sed ac est eu ligula
tincidunt. Proin condimentum rutrum lacini
Why does vim do this? I have yet to figure out the pattern. How can I make it format paragraphs "the correct way"?
Yes, vim's 'smartindent' is not well named. I had trouble with this for a while before I figured out what was wrong. For others, if you notice strange indenting behavior after lines starting with "if" or "for", unset smartindent. You will come across this a lot if you start using vim as a word processor.
From the vim help file, 'smartindent' will indent after a line starting with a keyword from 'cinwords', which is "if,else,while,do,for,switch", by default.
The problem was that I had "smartindent" enabled. Disabling this for LaTeX documents solved it:
au BufEnter *.tex set nosmartindent