DW (Dreamweaver) regular expression function list

Time:2021-10-7

Just used Teleport   Pro pulled a whole station to the local, and all hyperlinks were forced to add a tppabs = “…” newly installed system and Dreamweaver   8. Play the replacement function of DW. Search range: search the whole current local site: source code search: \ btppabs = “H [^”] * “replace: (empty) check: use the regular expression to click the replace all button OK ~ ~ done ~ ~

Example 2: it contains brackets, single quotation marks, etc

Find:href=”javascript:if\(confirm\(‘(.*?) ‘\)\)window\.location='(.*?)'”
Replacement: $1

Later, developeppaer shared an article to introduce DW’s regular expression in more detail. I guess you’ll like the Dreamweaver regular expression character search and replacement method ($1, $2 instructions)

Another: attach DW regular expression table

character

matching

Example

^

Enter the beginning of the or line.

^T matching“This good earth”Medium“T”, but it doesn’t match“Uncle Tom’s Cabin”Medium“T”

$

Enter the end of the or line.

h$ matching“teach”Medium“h”, but it doesn’t match“teacher”Medium“h”

*

0 One or more leading characters.

um* matching“rum”Medium“um”“yummy”Medium“umm”as well as“huge”Medium“u”

+

1 One or more leading characters.

um+ matching“rum”Medium“um”and“yummy”Medium“umm”, but in“huge”There are no matches in

?

The leading character can appear at most once (that is, indicating that the leading character is optional).

st?on matching“Johnson”Medium“son”and“Johnston”Medium“ston”, but in“Appleton”and“tension”There are no matches in

.

Any single character other than a newline character.

.an Matching phrase“bran muffins can be tasty”Medium“ran”and“can”

x|y

x or y

FF0000|0000FF matching bgcolor=”#FF0000” Medium“FF0000”and font color=”#0000FF” Medium“0000FF”

{n}

just right n A leading character.

o{2} matching“loom”Medium“oo”and“mooooo”The first two in“o”, but in“money”There are no matches in

{n,m}

at least n At most m A leading character.

F{2,4} matching“#FF0000”Medium“FF”and“#FFFFFF”The first four of“F”

[abc]

Any of the characters enclosed in parentheses. Specify a range of characters with hyphens (for example, [a-f] Equivalent to [abcdef])。

[e-g] matching“bed”Medium“e”“folly”Medium“f”and“guard”Medium“g”

[^abc]

Any character not enclosed in parentheses. Specify a range of characters with hyphens (for example,[^a-f] Equivalent to[^abcdef])。

[^aeiou] Initial match“orange”in“r”“book”Medium“b”and“eekMedium“k”

\b

Word boundaries (such as spaces or carriage returns).

\bb matching“book”Medium“b”, but in“goober”and“snob”There are no matches in

\B

Anything outside the word boundary.

\Bb matching“goober”Medium“b”, but in“book”There are no matches in

\d

Any numeric character. Equivalent to [0-9]

\d matching“C3PO”Medium“3”and“apartment 2G”Medium“2”

\D

Any non numeric character. Equivalent to [^0-9]

\D matching“900S”Medium“S”and“Q45”Medium“Q”

\f

Page feed.

\n

Line breaks.

\r

Carriage return.

\s

Any single white space character, including spaces, tabs, page breaks, or line breaks.

\sbook matching“blue book”Medium“book”, but in“notebook”There are no matches in

\S

Any single non white space character.

\Sbook matching“notebook”Medium“book”, but in“blue book”There are no matches in

\t

Tab.

\w

Any alphanumeric characters, including underscores. Equivalent to [A-Za-z0-9_]

b\w* matching“the barking dog”Medium“barking”as well as“the big black dog”Medium“big”and“black”

\W

Any non alphanumeric character. Equivalent to [^A-Za-z0-9_]

\W matching“Jake&Mattie”Medium

Find all hyperlinks, excluding http: / / and already available/
\shref\s*=[“‘][^(http)(/)]

href\s*=[‘][^(http)(/)]

href\s*=([“‘])([^(http)(/)])

href=$1/$2

Regular expressions replace or add different contents

For example, we need to add one to < a href =’whole-wedding-dresses. HTML ‘>/
The data to be searched should be grouped in parentheses in the search box, such as href \ s * = ([“‘] ([^ (HTTP) (/)])
Just use href = $1 / $2 in the replacement box