Throughout these examples I have used the regex
YourCodeHere
to and you should change this to match your needs
Line Operations
Using a capture Group
Find: ^.*YourCodeHere(.*) Replace: YourCodeHere\1
Add to the end of a line
- Open the Replace dialogue (Ctrl + H)
- Configure as follows:
- Find what:
$
- Replace with:
your content
- Search Mode:
- Regular expression
- without `. matches newline`
- Find what:
- Click Replace All
Notes
Multiline Search and Replace
- Notepad++ replace two lines with other (10) lines in open documents - Stack Overflow
- NppToolBucket | phdesign - A .NET plugin for Notepad++
- NppToolBucket contains the following features:
- Multi-line search and replace dialog.
- Change indentation dialog.
- Generate GUID
- Generate Lorem Ipsum
- Compute MD5 Hash
- Compute SHA1 Hash
- Base 64 encode
- Base 64 decode
- NppToolBucket contains the following features:
Delete Specific lines
A couple of methods to identify lines and delete them.
Regex
- Open the Replace dialogue (Ctrl + H)
- Configure as follows:
- Find what:
.*YourCodeHere.*\n .*YourCodeHere.*\r?\n
- Replace with: nothing
- Search Mode:
- Regular expression
- without `. matches newline`
- Find what:
- Click Replace All
Notes
- The end of line character should be
\n
if straight from your Linux box, but you might just want to check this as it could be\r\n
YourCodeHere
should be swapped for something on each of the lines you want to delete.- Notepad++ Delete Lines with Find & Replace - Super User
- some useful end of line regex that might still be valid.
Bookmark Line Method
Delete all lines that don't contain ....
A couple of methods to identify lines and delete all the others.
Inverse Regex Replace
- Open the Replace dialogue (Ctrl + H)
- Configure as follows:
- Find what:
^(?!.*YourCodeHere).*\r?\n ^(?!.*YourCodeHere).*\R # When this is used, blank lines are left ^((?!YourCodeHere).)*$
- Replace with: nothing
- Search Mode:
- Regular expression
- without `. matches newline`
- Find what:
- Click Replace All
Bookmark Line Method
- Select the Mark tab from the replace dialogue (Ctrl + H)
- Enter your Regex to match code on the lines you want to keep.
YourCodeHere # This will allow marking of all lines not containing [ERROR] ^((?!YourCodeHere).)*$
- Your Regex does not need to match all of the content on the line, just something unique to allow identification.
- Check Bookmark line.
- Search Mode:
- Regular expression
- without `. matches newline`
- Click Mark All.
- Menu --> Search --> Bookmark --> Remove Non-Bookmarked Lines
- In the replace dialogue, Mark tab, click Clear all marks.
Remove Duplicate Lines
- Method 1
- Edit --> Line Operations --> Remove Duplicate Lines
- Edit --> Line Operations --> Sort Lines Lexicographically Ascending (this is optional but makes them easier to read.)
- Method 2
- Edit --> Line Operations --> Sort Lines Lexicographically Ascending
- Edit --> Line Operations --> Remove Consecutive Duplicate Lines
Delete the first part of a line
Find: ^.*YourCodeHere Replace: YourCodeHere or Find: ^.*?YourCodeHere Replace: YourCodeHere
Line Endings (EOL / CR / LF)
A collection of hints and tips of this topic.
- The default Notepad++ font `Courier New` does not support a lot of Unicode characters such as the CRLF character.
- Notepad++ End of Line: How to Change It and Why - Notepad++ end of line settings: Learn how to change the end of line character in Notepad++. This article includes step-by-step instructions and screenshots.
To View Line Endings in Notepad++:
- Go to View > Show Symbol > Show End of Line
- CR LF for Windows line endings
- LF for Unix-style
- CR for old Mac-style
- This will display actual newline characters:
- These aren’t shown as ↵, but they indicate the same thing.
If you want ↵ to Show where Newlines Occur:
Notepad++ supports showing newlines as CR/LF/CRLF
but does not support showing newlines as ↵
, however you can simulate it:
- Use Find and Replace (Ctrl+H)
- Set Search Mode to Extended
- Find: \r\n or \n
- Replace with: ↵\r\n (this will visually insert ↵ at line breaks)
- Be careful—this alters the file.
Regex
- Non-Greedy
- Notepad++ supports non-greedy regular expressions, which are useful for matching the shortest possible string that satisfies the pattern. This can be achieved using the
?
operator after a quantifier. See the example below:<h1 style="color: red">Hello</h1> <h1.*?> - This will match <h1 style="color: red"> <h1.*> - This will match <h1 style="color: red">Hello</h1>
- Notepad++ non-greedy regular expressions - Stack Overflow
- you can specify what you don't want:
a[^c]+c
- Which specifies: match
a
, followed by one or more character that isn'tc
, followed byc
. This will matchabc
andadc
.
- Which specifies: match
- you can specify what you don't want:
- Notepad++ Find and Replace Expert Suggestion - Super User
- Notepad++ supports non-greedy regular expressions, which are useful for matching the shortest possible string that satisfies the pattern. This can be achieved using the
- Line Endings (EOL)
- \R (capital R) will grab any end of line characters in Notepad++.
- ^ for start of line.
- $ for end of line, but does not identify the EOL.
- Inverse Regex Selection/Match
- see my Inverse Regex Replace under the deleting lines section.
- How can I invert my Regex matching results? - Super User
- notepad++ Inverse Regex replace (all but string) - Stack Overflow
Themes
- Notepad++ • Dracula Theme - The most famous dark theme for Notepad++ and an ever-growing selection of apps!
Misc
How to add a TPL file to Notepad++ as a PHP file
- Click Settings / Style Configurator
- Select PHP in the left list box
- At the bottom of the list boxes, you'll see User Ext:. Enter tpl into that box
- Click Save & Close
Now Notepad++ will recognise .tpl files as PHP files. When you open the next one, it will contain syntax highlighting.
A question mark or a box is shown instead of the EOL character?
- I am using the Fira Code here for this example but this will apply to all fonts where this occurs
- The EOL character is shown when using the DejaVu Mono font.
- The question mark character is shown is when the required glyph does not exist in the current font.
- When copying text, the glyph references are copied not the characters, so if a character does not show correctly in one application this does not mean this will be the same in another.
The issue you're encountering is due to the Fira Code font not supporting the ↵
character (Unicode U+21B5: "DOWNWARDS ARROW WITH CORNER LEFTWARDS").
Here's a breakdown of what's going on:
- ✅ DejaVu Mono
- DejaVu Mono is a very complete font that includes a wide range of Unicode symbols, including many technical and typographic ones.
- It supports the ↵ character, so it displays correctly.
- ❌ Fira Code
- Fira Code is a monospaced programming font known for its ligatures (like turning
!=
into a neat symbol), but it has a more limited set of Unicode glyphs compared to DejaVu Mono. - It does not include a glyph for
↵
, so Notepad++ shows a replacement character (typically a question mark or a box), indicating a missing glyph.
- Fira Code is a monospaced programming font known for its ligatures (like turning
Solutions or Workarounds
- Use a different symbol:
- You can try using a visually similar symbol that Fira Code does support (e.g.,
↩
,↓
, or⏎
), though it’s not the same.
- You can try using a visually similar symbol that Fira Code does support (e.g.,
- Use a different font:
- If Unicode coverage is important and you're dealing with many special characters, consider using a font like:
- JetBrains Mono
- Cascadia Code
- DejaVu Mono
- DejaVu Sans
- Segoe UI Symbol
- Arial Unicode MS
- Use a custom build of Fira Code with extended Unicode coverage (more advanced).
- If Unicode coverage is important and you're dealing with many special characters, consider using a font like:
- Use a different editor:
- Switch to a different editor that supports font fallback (like VS Code, Sublime Text, etc.).
To Verify a Character is supported in a font
You can test if Fira Code supports a character by:
- Checking it in a font viewer (like BabelMap or FontDrop).
- Viewing it in a browser with Fira Code explicitly set as the font.
- Set your editor to use the required font, then copy and paste in the character from somewhere it is shown correctly.
Why ↵ works in VS Code but Not in Notepad++
VS Code and Notepad++ handle fonts very differently, particularly when it comes to missing glyphs:
- ✅ VS Code: Font Fallback Support
- VS Code uses Electron/Chromium, which supports font fallback.
- When Fira Code doesn't include a glyph (like ↵), VS Code will automatically fall back to another installed font that does support it (e.g., DejaVu Sans Mono or Segoe UI Symbol).
- So even though Fira Code doesn’t include ↵, VS Code silently substitutes it from another font.
- ❌ Notepad++: No Font Fallback
- Notepad++ uses the Windows GDI or Scintilla rendering engine, which lacks proper font fallback.
- If the selected font (Fira Code) doesn’t include a glyph, Notepad++ simply shows a replacement character (usually a box or question mark), because it won’t switch to another font.
✅ Summary
App | Font Used | ↵ Glyph Supported by Font? | Font Fallback? | Result |
---|---|---|---|---|
VS Code | Fira Code | ❌ | ✅ Yes | ✔️ Displays ↵ |
Notepad++ | Fira Code | ❌ | ❌ No | ❌ Question mark |
Additional Fonts
- Notepad Plus Plus instructions · tonsky/FiraCode Wiki · GitHub - A Free monospaced font with programming ligatures.
- How to install this font into Notepad++
- Ligatures are not on by default, the DirectWrite option needs to be enabled.
ChatGPT Code Clean up
Using the regex below and Notepad++ remove the tag data and then remove unwanted paragraphs in list items allowing for correctly formatted information in my articles.
Remove all of the unwanted tag data
Method 1
- This regex simply removed unwanted style and
data-start=""
anddata-end=""
meta values fromall html elements (eg:<ul data-start="1463" data-end="1764">
--><ul>
) - This will require the WYSIWYG to remove the unneeded white space, which it should and if not this will not affect the code but just how nice it looks.
- The regex code only needs to be run once.
- Regular expression, no `. matches newline`
Find what: (data-start="[0-9]+"|data-end="[0-9]+") Replace with:
Method 2
- This regex simply removed unwanted style and data tags from the specified html elements (eg:
<ul data-start="1463" data-end="1764">
--><ul>
) - This will handle self closed tags
- The regex code only needs to be run once.
- This will always find matches even if all the elements/tags are empty and nothing needs to be removed.
- Regular expression, no `. matches newline`
Find what: <(h1|h2|h3|h4|h5|h6|pr?e?|br|ul|ol|li|strong|code|em){1}.*?/?> Replace with: <\1>
Remove Nested <p>...</p> Tags from <li>...</li> but keep all Content
Method 1
- To remove all
p
tags nested withinli
tags with a single replace operation in Notepad++, use a regex that captures all the content between a<li>
and</li>
tag and then replaces the nested<p>
and</p>
tags. - This will find and remove the
<p>
tags while preserving their content, but only when they are within<li>
tags. - This regex needs to be run until all matches are found and replaced as it might not be able to do all changes on the first run. Multiple
<p></p>
in a<li></li>
will require additional runs. - Regular expression, no `. matches newline`
Find what: (<li>[\s\S]*?)<p>([\s\S]*?)</p>([\s\S]*?</li>) Replace with: \1\2\3
Explanation of the Regex
(
: Starts a capturing group.<li>
: Matches the literal opening<li>
tag.[\s\S]*?
: Matches any character (\s
for whitespace,\S
for non-whitespace) zero or more times, non-greedily. This captures everything between the<li>
and the<p>
tag.)</p>
: This ends the first capturing group and literally matches the opening<p>
and closing</p>
tags.([\s\S]*?)
: This is the second capturing group, which matches the content inside the<p>
tags.([\s\S]*?</li>)
: This is the third capturing group, which matches everything from the closing</p>
tag up to the closing</li>
tag.\1\2\3
: In the "Replace with" field, these refer to the content of the three capturing groups. This tells Notepad++ to reconstruct the text using the parts it captured, effectively removing the<p>
tags.
Make sure you have Regular expression selected in the "Search Mode" area of the Find and Replace dialog.
Method 2
- To remove all
p
tags nested withinli
tags with a single replace operation in Notepad++, use a regex that captures all the content between a<li>
and</li>
tag and then replaces the nested<p>
and</p>
tags. - This finds <li><p>...</p> and removes the <p></p>
- This regex needs to be run until all matches are found and replaced as it might not be able to do all changes on the first run. Multiple
<p></p>
in a<li></li>
will require additional runs. - Regular expression, no `. matches newline`
Find What: (<li>[\s\S]*?)<p>(.*?)<\/p>(?=[\s\S]*?<\/li>) Replace with: $1$2
Explanation of the Regex
This regex uses a combination of capturing groups and a positive lookahead to find and replace all instances within a single pass.
(
and)
: These create a capturing group.(
starts the group, and)
ends it.<li>
: Matches the literal opening<li>
tag.[\s\S]*?
: This non-greedy pattern matches any character (including newlines) zero or more times, capturing everything after the<li>
tag.)*?)
: The first capturing group ends here. This group captures the content from the opening<li>
tag up to the first<p>
tag.<p>
: Matches the literal opening<p>
tag.(.*?)
: This is the second capturing group. It non-greedily matches all content within the<p>
tags.<\/p>
: Matches the literal closing</p>
tag.(?=[\s\S]*?<\/li>)
: This is a positive lookahead. It asserts that the matched pattern is followed by a closing</li>
tag. The[\s\S]*?
matches any character zero or more times until it finds a</li>
tag.
When you use $1$2
in the "Replace with" field, Notepad++ will replace the entire matched string with the content of the first and second capturing groups, effectively removing the <p>
tags while preserving their content and the surrounding li
structure.
Important: Make sure Regular expression is selected in the Search Mode section of the Find and Replace dialog. You may also need to check the . matches newline
box.
Method 3 + 4
These all assume that there is only one <p>...</p> in each <li>...</li>
## Remove the first nested <p> Find what : <li>[\r?\n?]+<p> Replace With: <li> ## Remove the last nested</p> Find what : </p>[\r?\n?]+</li> Replace With: </li> ## Remove the first pair of nested <p>...</p> Find what : <li>\s*(?:<p>(.*?)</p>\s*)+</li> Replace With: <li>\1</li>