Find missing words in rows in Notepad++ - find

I have a folder with 2 kind of sentences/rows. One that has < h1 > tag, and other doesn't. Like so:
< td class="articles">Mama< /td>
< td class="articles">< h1>Tata < /h1>< /td>
I want to find with Notepad++ only the rows that doesn't have the word < h1>
Does anybody know how to do this?

Use the find or replace window (ctrl+f) or (ctrl+h) and set it to use regular expressions.
Now use the regex:
(?-s)(?i)^(?:.(?!<(?: |\t)h1(?: |\t|>)))*$
This will find any line that doesn't contain for example:
< h1 >
<h1 style="">
<H1 >

Use the Mark functionality (tab in the find window.) Make sure bookmark line is checked and search for 'h1'. The lines that are not bookmarked are the lines without a h1.

You can use the "Find All In Current Document" option with negative regex match operator: !

Related

How to change the formatting of VS Code with Prettier enabled?

When I use CTRL+S, my code is automatically formatted to this:
< h1 > Title < /h1 >
where it all saves to the same line. But I want it to format like this:
< h1 >
Title
< /h1 >
Where all three properties are saved to their own respective line. I prefer this because it makes it personally makes it better for me to read and edit my code.
How do I change this?
You cannot change the way how this extension format your code! But you can keep this extension enabled and make HTML as an exception like this way:
create a .prettierignore file
{
"editor.defaultFormatter":"esbenq.prettier-vscode",
"[HTML]":{
"editor.defaultFormatter":"<another formatter>"
}
}

How do I change opening and closing tag at the same time in Sublime Text 3

What is the easiest way to change the opening and closing code tag?
I especially need a way to do it using Sublime Text 3's Multi-Select... so I don't have to change it 1,000 times. And find and replace won't work because I need to change only specific matches.
EX: CHANGE ALL DIVs with class="item" to tr tags
(ignore my improperly formated code this is for example only)
<div class="item">foo foo bar is foofoobar</div>
<div class="item">bar foo is barfoo</div>
<div> not a match for .item</div>
<div class="item">foo bar foo is foobarfoo</div>
BECOMES
<tr class="item">foo foo bar is foofoobar</tr>
<tr class="item">bar foo is barfoo</tr>
<div> not a match for .item</div>
<tr class="item">foo bar foo is foobarfoo</tr>
I couldn't find the answer so I'm answering my own question.
What is the easiest way to change the opening and closing code tag?
I especially need a way to do it using Sublime Text 3's Multi-Select... so I don't have to change it 1,000 times. And find and replace won't work because I need to change only specific matches.
HERE GOES - THE ANSWER :
Install Emmet
Then select the opening tag you want to change.
(if you need to multi select -->) Hit ALT + F3.
Now (with Emmet installed) hit CTRL + SHIFT + u
Now change your tag and hit enter/return
EX: CHANGE ALL DIVs with class="item" to tr tags
(ignore my improperly formated code this is for example only)
<div class="item">foo foo bar is foofoobar</div>
<div class="item">bar foo is barfoo</div>
<div> not a match for .item</div>
<div class="item">foo bar foo is foobarfoo</div>
Highlight div class="item"
hit ALT + F3 to select all matching divs
hit CTRL + SHIFT + u
type "tr" and hit enter
DONE PRESTO MAGICO
<tr class="item">foo foo bar is foofoobar</tr>
<tr class="item">bar foo is barfoo</tr>
<div> not a match for .item</div>
<tr class="item">foo bar foo is foobarfoo</tr>
POSSIBLE ISSUES:
Package Control not working
I had to uninstall Package Control before installing Emmet as my Package Control had become corrupt somehow.
Solution:
This post answers the question of how to fix a corrupt package control item.
Why is Sublime Package Control not working?
Wrong Shortcode
It is possible your shortcode is conflicted with another plugin or your shortcode has changed from the default assignment.
Solution:
Go to
Preferences > Package Settings > Emmet > Key Bindings - Default
Look for "update_as_you_type" and check the "keys" assigned. This is the keyboard shortcut you should be using. If that still does not work. Try changing the key assignment.

NetBeans commenting

I'm using the popular IDE NetBeans and I have problems commenting code on the same line. For example, let's say we have the following line:
<h1> Some text </h1> comment for h1
I would like to comment the part "comment for h1" through a key combination or some other means but without having to type manually and without transferring the comment string to the next line. I usually use ctrl+/ but this key combination comments the whole line, which is not what I want.
Why not Select & Replace all such occurences.
You can use Ctrl + Shift + H and enter the text which you want to replace.
Add the text (say comment for h1) to be commented in the field Containing Text, and replace that text with //comment for h1 in the Replace With field.
Then it will show you all the matches which you want to comment. You can select the desired places where you want to place comment before the text.
Finally, click on Replace ? Matches button. Voila, that's it...
You can always create your own keyboard shortcut, see how in this link.
Then you can customize your keyboard to replace your highlighted text with the same text with /* */ , // , <!-- --> or any others before/surrounding the text.
Example:
<h1> Some text </h1> comment for h1
Highlight the text you need to comment (comment for h1).
Use your customixed shortcut and:
<h1> Some text </h1> /*comment for h1*/
I haven't tested this, please tell me your feedback ;)
I've decided to do this by recording 2 macros and assigning shortcuts to them:
ctrl + shift + A for the html comment <!-- -->
ctrl + shift + \ for the php comment /* */.
Both macros position the mouse cursor in the middle of the comment section so it is convenient to enter a comment. This doesn't work with an existing comment.
select the texe and use Ctrl+Shift+C

New lines inside paragraph in README.md

When editing an issue and clicking Preview the following markdown source:
a
b
c
shows every letter on a new line.
However, it seems to me that pushing similar markdown source structure in README.md joins all the letters on one line.
I'd like the new lines preserved in the README.md in this project: https://github.com/zoran119/simple-read-only-test
Any idea how?
Interpreting newlines as <br /> used to be a feature of Github-flavored markdown, but the most recent help document no longer lists this feature.
Fortunately, you can do it manually. The easiest way is to ensure that each line ends with two spaces. So, change
a
b
c
into
a__
b__
c
(where _ is a blank space).
Or, you can add explicit <br /> tags.
a <br />
b <br />
c
You can use a backslash at the end of a line.
So this:
a\
b\
c
will then look like:
a
b
c
Notice that there is no backslash at the end of the last line (after the 'c' character).
If you want to be a little bit fancier you can also create it as an html list to create something like bullets or numbers using ul or ol.
<ul>
<li>Line 1</li>
<li>Line 2</li>
</ul>
You should use html break <br/> tag
a <br/>
b <br/>
c
Using the mentioned methods above didn't work for me in all cases.
I ended up adding "##" to add a new line!
a
##
b
##
c
According to Github API two empty lines are a new paragraph (same as here in stackoverflow)
You can test it with http://prose.io

How to search for this string using regular expressions in Eclipse?

I am trying to find and replace this lines:
<div id="fixed_bottom"></div>
</div>
<jsp:include flush="true" page="../includes/footer.jsp"/>
with this:
<jsp:include flush="true" page="../includes/footer.jsp"/>
<div id="fixed_bottom"></div>
</div>
And I do not know how to find them, because there are two line breaks in the sentence.
Any help would be appreciated, thank you so much!
\n or \r\n indicate line break in a regular expression depending on what OS you are on. See http://www.regular-expressions.info/reference.html for more help on regular expressions
If you are using the built in Eclipse "Search File" with the regular expression box checked it will build the search string for you (if you had it highlighted before you opened search box). Note if you have to check the regular expression box you need to close the dialog and re open to get it to refresh. From there you can see Eclipse uses the somewhat odd \R for newlines.