notepad ++ Regular expressions batch editing MYsql

notepad ++ Regular expressions batch editing MYsql

today i want to delete <a href="http://yourewebsite.com/.xxxxx.jpg"> in mysql data, but it's too many data to fix it with my hands, so i use notepad ++ and Regular expressions to replace it all , as a mark

Notepad++ regular expression syntax

\ Escape character Such as: to use “\” itself, you should use “\ \”

\t The Tab tab  notes : expansion and regular expressions support

\r Returns CR notes Extended support does not support regular expressions

\n Newline LF notes Extended support does not support regular expressions

. Match any character

^ The expressions on the right side of the match at the beginning of the. Such as: ^A, A at the beginning of the line

$ The expressions on the left side of the match at the end of the line. Such as: e$, with “e” at the end of the line

| Or operator, string matching expressions of left and right. Such as: ab|bc, “ab” or “bc”

[] Matches any single character list. Such as: [ab], “a” or “B”; [0-9] matches any single digit

[^] Matches any single character list. Such as: [^ab], “single character a” and “B” outside; [^0-9] matches any single non numeric character

* To the left of the character is to match any time (0 or more). Such as: be*, “B”, “be” or “bee”

+ To the left of the character is, at least once (1 or more). Such as: be+, “be” or “bee”, but does not match the “b”

? To the left of the character is, 0 times or 1 times. Such as: be?, “B” or “be”, but does not match the “bee”

() Effect of expression matching sequence (C++ like parentheses will affect the expression of the order of operations), and Be used as Packet marking expressions (Mark since 1) notes See example below:

\d Matches a digit character. Equivalent to: [0-9]

\D \d, a non numeric character matching. Equivalent to: [^0-9]

\s Matches any single character: including blank spaces, tabs, etc. (Note: do not include the change character and newlines). Equivalent to: \t]

\S \s take any single character counter.

\w Matches any single character including underscore. Equivalent to: [A-Za-z0-9_]

\W \w take any single character counter. Equivalent to: [^A-Za-z0-9_]

Example 1

123abcfg
ABC
ABCD

Replace:

123hello
Hello
Hello

Methods: search string: abc.*$replacement string: Hello

Example 2

123abcfg
ABC
ABCD

Replace:

[email protected]@
@[email protected]
@[email protected]

Methods: search string: $(abc.*) replacement string: @\[email protected]

Example 3

Str[1]abc[991]
Str[2]abc[992]
Str[11]abc[993]
Str[222]abc[996]

replace with

God[991]
God[992]
God[993]
God[996]

Methods 1 — search string: str\[[0-9]+\]abc\[([0-9]+) \] replacement string: god[\1]

Methods 2 — search string: str\[([0-9]+) \]abc\[([0-9]+) \] replacement string: god[\2]

Example 4 Delete all blank lines

Step1:a. B. regular expression search string: \t]*$^[replacement string: empty

Step2:a. (\n, \r, extended \t, \0, \x… B.) search string: \r\n\r\n replacement string: \r\n notes Multiple click replace string, until there is no alternative

root

Leave a Reply

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