Working with EditPlus Text Editor-Regular Expression How To

Editplus is a lot better than the regular text editor, Notepad. From all it’s features I like RegExp Support the most, and than comes the block select feature. Here are the quick lines to carry out regular tasks using regular expression in Editplus. Most steps will also work with other editors supporting regular expressions like Notepad++.

It’s kinda downloadable editplus regular expression cheetsheet list.

How To Remove all empty lines in EditPlus or Notepad++

Find: "^\n" (Ignore double-quotes in all find/replace)
Replace: ""

Where,
^ - Beginning of the line
\n - New Line


How To Remove Multiple Spaces convert into single space in EditPlus or Notepad++

Find: ” +”
Replace: ” “
Where,

How To Find one or more occurance of space character EditPlus

Comment multiple line of code:
Find: "^"
Replace: "#" or "//"
You may optionally use: Edit Menu > Format > Line Comment.

How To Generate Comma Separated List from new line delimited list

Find: "\n"
Replace: ", "
This helps in even joining some of lines of code instead of replacing by comma you may replace it with "".

How To Manipulate columns display order / punctuation


Find: "([0-9]+)\t([a-zA-Z]+)"
Replace: "\2\t\1"

Where,
[0-9]+ - Finds one or more digits
[a-zA-Z]+ - Finds one or more characters
() - mark the block or capture the group
\2 - 2nd mark expression

For example original text as follows:
123 abc
345 cde
567 efg

becomes:
abc 123
cde 345
efg 567

The Other Way:

- Press Alt+C
- Drag you mouse to select respective column and click
- Copy / Cut as required

Append / Add semicolon (any character) at the end of the line

Find: "\n"
Replace: ";\n"

Enclose lines by quotes

Find: "\n"
Replace: "'\n'"

Delete all lines containing a given STRING

Find: "^.STRING.$"
Replace: ""


How To Remove lines not containing a given STRING

I don’t know how to do this!! 🙂

How To Convert tab separated file into insert statements


TSV: abcd de4 iirn 34399
SQL: INSERT INTO TABLENAME VALUES ("abcd", "de4", "iirn","34399");
Find: "(.)\t(.)\t(.)\t(.)"
Replace: "INSERT INTO TABLENAME VALUES ("\1", "\2", "\3","\4");"
Format the telephone number:
Find: "([0-9][0-9][0-9])([0-9][0-9][0-9])([0-9].*)"
Replace: "\1-\2-\3"
For example:
Original: 1231231231
Formatted text becomes: 123-123-1231

How To Remove Brackets

Find: "(|)"
Replace: ""
Where,
( -> Match (. \ is required to escape marking the expression.
| -> or

How To Replace 1st occurrence of character


Find: " (.)" Replace: "-\1" Where, (.) - matches everything and marks the block
** Make sure you ignore double-quotes(") while writing in find / replace boxes.
EditPlus supports following regular expressions in Find, Replace and Find in Files command.
Expression - Description
\t - Tab character.
\n - New line.
. - Matches any character.
| - Either expression on its left and right side matches the target string.
[] - Any of the enclosed characters may match the target character.
[^] - None of the enclosed characters may match the target character.
- Character to the left of asterisk in the expression should match 0 or more time.
- Character to the left of plus sign in the expression should match 1 or more times.
? - Character to the left of question mark in the expression should match 0 or 1 time.
^ - Expression to the right of ^ matches only when it is at the beginning of line.
$ - Expression to the left of $ matches only when it is at the end of line.
() - Affects evaluation order of expression and also used for tagged expression.
\ - Escape character. If you want to use character "\" itself, you should use "\".

Notable Features of Editplus are

Spell checking
Regex-based find & replace
Encoding conversion
Newline conversion
Syntax highlighting
Multiple undo/redo
Rectangular block selection
Auto indentation
Code folding (Text folding)

Download pdf: Editplus-RegExp.

Conclusion: EditPlus, with its support for regular expressions, offers a versatile platform for efficient text editing and manipulation. By mastering the techniques covered in this article, you can harness the full power of regular expressions in EditPlus to streamline your workflow, automate repetitive tasks, and achieve cleaner and well-formatted text. Take advantage of features like spell checking, encoding conversion, syntax highlighting, and more, as EditPlus empowers you to become a proficient text editor. With regular expressions as your tool, the possibilities are endless in EditPlus. Elevate your text editing game and unlock new levels of productivity with these invaluable tips and tricks.

58 comments
  1. Hi ..First of all thanks for the beautiful articles on Edit Plus .

    I want to autoconvert the case for sql syntax

    Like SeleCT * from
    if I write like something above it should be autocased to

    SELECT * FROM as SELECT and from are the keywords

  2. how can i random lines with regex ?
    ex:

    1
    2
    3
    4
    5
    6
    7

    and i want to be anything random like

    4
    2
    1
    7
    …..

  3. Hello,
    i have a list of thousands line like this:
    some text here some other text here
    some text here some other text here
    some text here some other text here
    some text here some other text here

    Is there a way to delete the codes between the “” “” to obtain this?
    some text here some other text here
    some text here some other text here
    some text here some other text here
    some text here some other text here

  4. How to replay SOH (Start of Heading) character i.e. ASCII – 1 with Pipe (|) in Editplus ? Do I need to use Regex ?
    thanks

  5. I need to delete all characters between two (2) known strings. and (I have hundreds of HTML pages with hundreds of instances on each page… please HELP!)

    Example:
    FIND: #footnote15 misc characters not[ always the () same 12
    REPLACE: Everything between the ” and the ”
    I can easily search and replace the leftover “” later.

    1. (Let me try this again… <sup> and </sup> Characters were omitted in my first post!)
      I need to delete all characters between two (2) known strings. <sup> and </sup> (I have hundreds of HTML pages with hundreds of instances on each page… please HELP!)

      Example:
      FIND: <sup> #footnote15 misc characters not[ always the () same 12 </sup>
      REPLACE: Everything between the ‘<sup>’ and the ‘</sup>’
      I can easily search and replace the leftover “<sup></sup>” later.

      1. Not sure exactly but see if this is what you want:
        Find: .*\r\n
        Replace:

        If \r\n doesn’t work, try with only \n

        If not, share more.
        Cheers.

  6. HI,
    Iam using editplus,in this when i press space button it is showing dot at before of everyword,could anybody help me plz,how can i remove the dots.
    eg:version:(dot)(dot)(dot)1

    1. Too late to answer i guess! Did you find your answer? Did you somehow messed up in your space charter settings somewhere? care to share?

      Regards.

Leave a Reply

Your email address will not be published. Required fields are marked *