“Find and Replace” is a huge time saver but sometimes you need something more flexible than replace ‘x’ with ‘y’.

  • Once you know these Windows keyboard shortcuts, you'll be able to get all your tasks done in a snap. The post 23 Window Keyboard Shortcuts: A Cheat Sheet appeared first on Reader's Digest.
  • Padding-bottom:; pb padding-left:; pl width:; w width:auto; w:a height:; h height:auto; h:a max-width:; maw max-width:none; maw:n max-height:; mah.
  • Download cheat sheet as printable PDF A5. Support: info@emmet.io Created with DocPad and Gulp.js Minimal theme by orderedlist. View page source on GitHub.

This is where Regular Expressions come in handy.

This article explains how to use wildcards and other advanced features that gives super powers to the humble “Find and Replace” modal.

HTML Cheat Sheet PDF. Save the.pdf version of this interactive page to keep it on your desktop or print it and hang it on the wall and always sneak a peek while coding, composing an article or designing a website. A PDF file is available for every cheat sheet on this website: CSS, JavaScript and others.

This article uses a free program called Notepad++. If you don’t have it, you candownload it here.

How to Wrap paragraphs with Find/Replace

Consider this example…

Say you have a document formatted like the image above. Imagine you needed to wrap each paragraph in <p> tags. A normal “Find and Replace” can’t do that, but it’s possible with “Regular Expressions”.

Notepad++ Cheat Sheet

Here’s how to do it in Notepad++

  1. Find and Replace

    In Notepad++ press Ctr+H to open the “Find and Replace” window.

  2. Click “Regular Expression” option

    Under Search Mode: choose “Regular expression” and then check the “matches newline” checkbox.

  3. Add <p> tag to beginning of each line

    Find what: n.
    Replace with: n n<p>

  4. Notice Added <p> tag

    You should see <p> tags at the beginning of each line

  5. Add Closing </p> tag

    Find what: n n
    Replace with: </p> n n

  6. Notice Closing </p> tags

    You should see closing </p> tags at the end of each line.

So what’s happening here?
n‘ looks for a line break.
.‘ is a wildcard that matches any single character.
So ‘n.‘ looks for a line break followed by two characters of text.

In other words, we’re saying “find a new line with content”, (not a blank line) then replace it with 2 new lines and a “<p>” tag.

To close the paragraphs, we’re saying “find 2 line breaks in a row” (because we just made sure to add to breaks in between each paragraph) and replace it with a closing </p>”.

Cheat Sheet

Here’s a list of useful expressions you may want to use in your find and replace escapades…

n
line break
t
Tab
d
A digit in the 0-9 range (a number)
D
Not a digit. Anything that’s not a number (including spaces).
l
A lowercase letter.
NOTE: this will fall back on “a word character” if the “Match case” search option is off.
L
Not a lower case letter. See note above.
u
An uppercase letter.
U
Not an uppercase letter.
w
A word character, which is a letter, digit or underscore. This appears not to depend on what the Scintilla component considers as word characters. Same as [[:word:]].
W
Not a word character.
s
A spacing character: space, EOLs and tabs count.
S
Not a space.
h
Horizontal spacing. This only matches space, tab and line feed.
H
Not horizontal whitespace.
v
Vertical whitespace.
V
Not vertical whitespace
$
Only applies to character at the end of a line. (ex. ‘!$’ would replace all explamation points at the end of a line.)
^
Online applies to character at the beginning of a line (ex. ‘^<p>’ would replace any ‘<p>’ at the beginning of a line.)

Replace Multiple Spaces with Tab

Want another useful tip?

Let’s say you have code that was indented with lots of spaces. Replacing all those spaces with tabs, would make the code much cleaner.

Let’s say you want to replace every 4 spaces with 1 tab.

  1. In the Find whatfield type: ([ ]{4})

2. In the Replace with field type: t

Don’t forget to have the Regular Expression radio button selected (just like before).

If you need a different number of spaces, just change the number. For example if you want to replace 6 spaces use the following: ([ ]{6})

Credit: I found this tip at https://datacadamia.com/ide/notepad/replace.

Bonus Tip!
Alternative Online Tools That Make Text Conversion Easier

Sometimes expressions can be a little hard to figure out. If you’re looking for some simple online tools, you might try diffchecker.com, titlecase.com, and textmechanic.com.

I’ll talk about each…

Check for differences between 2 sets of text

The other day, I wanted to check for differences between 2 websites. I had a WordPress theme that I knew I’d made some changes to, but I couldn’t remember exactly what they were.

I found a useful website called https://www.diffchecker.com that let me copy and paste the code for the two sites and highlighted the differences for me.

Changing All Caps to Titlecase

I frequently get text from clients in ALL CAPS, and I often want to change it to Title Case or sentence case without having to retype it.

TitleCase.com will convert your text to Title Case, UPPERCASE, lowercase, or Sentence case. It will even do programming specific conversions like camelCase, PascalCase, hyphen-case, or snake_case. Pretty useful!

Miscellaneous Text Editing Tools with Text Mechanic

Textmechanic.com has a variety of bulk text editing tools.

Here’s a few of the tools they have…

Let Us Know Your Thoughts

Sheet

As I was reviewing my analytics, I noticed this article has become quite popular, but strangely has far fewer comments than our other popular articles. I realized that might be because there was no invitation to comment. So I’ve decided to fix that.

Was this article useful?

Do you have any useful tricks for Advanced Find & Replace functionality?

Let us know in the comments below…

General

Open file

  • Ctrl
  • O

Save

  • Ctrl
  • S

Save all

  • Ctrl
  • Shift
  • S

Close all

  • Ctrl
  • Shift
  • W

Restore recently closed file

  • Ctrl
  • Shift
  • T

Editor

Lowercase

  • Ctrl
  • U

Proper case, blend

  • Alt
  • Shift
  • U

Sentence case, blend

  • Ctrl
  • Alt
  • Shift
  • U

Join lines

  • Ctrl
  • J

Move down current line

  • Ctrl
  • Shift
  • Down

Insert blank line below current

Notepad++ Cheat Sheet 2019

  • Ctrl
  • Alt
  • Shift
  • Enter

Single line comment

  • Ctrl
  • K

Block comment

  • Ctrl
  • Shift
  • Q

Path completion

  • Ctrl
  • Alt
  • Space

Function parameters hint

  • Ctrl
  • Shift
  • Space

Find

  • Ctrl
  • F

Tropico 1 guide. Find next

  • F3

Select and find next

  • Ctrl
  • F3

Find next, volatile

  • Ctrl
  • Alt
  • F3

Replace

  • Ctrl
  • H

Search results window

  • F7

Next search result

  • F4

Go to matching brace

  • Ctrl
  • B

Select style 1-5

  • Ctrl
  • Shift
  • 1-5

Toggle bookmark

  • Ctrl
  • F2

Previous bookmark

  • Shift
  • F2

Post-it

  • F12

Next tab

  • Ctrl
  • PgDn

Move tab forward

  • Ctrl
  • Shift
  • PgDn

Switch to previous document

  • Ctrl
  • Shift
  • Tab

Hide lines

  • Alt
  • H

Fold all

  • Alt
  • 0

Collapse current level

  • Ctrl
  • Alt
  • F

Text direction right-to-left

  • Ctrl
  • Shift
  • R

Toggle macro record

  • Ctrl
  • Shift
  • R

Run

  • F5

Trim trailing space and save

Notepad++ Cheat Sheet Excel

  • Alt
  • Shift
  • S