In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how Dreamweaver implements regular expression character search and replacement. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1. Open the find and replace dialog box
two。 Select folder in the look in option, and then select the folder you want to batch replace (of course, you can also select current document)
3. Add: ([Amurz] *) to "find"
4. Add: $1 to "replace"
5. Select "use regular expressions" in options (please note, be sure to select this)
6. Just click replace all.
Analysis:
The third and fourth steps are the most important in the whole process. In the third step, regularization ([amurz] *) is used. What does this mean? According to the regular syntax:
(pattern)-- matches the pattern and gets the match. The obtained match can be obtained from the resulting Matches collection, which uses the SubMatches collection in VBScript and $0 in JScript. $9 attribute. Notice that in Dreamweaver it starts at $1.
[xyz]-- matches any character contained. [Amurz] means matching any uppercase and lowercase English characters.
*-- matches the previous subexpression zero or more times, in this case [amurz] zero or more times.
The whole expression ([Amurz] *) means that any number of consecutive uppercase and lowercase English characters are matched, and the resulting zoning can be obtained from Matches.
From the above explanation, it is easy to know that the $1 in step 4 represents the first match in the Matches collection. In this case, any number of consecutive English characters. As for the detailed regular expression syntax, you can look it up online, or you can find it in the next JavaScript.chm, so I won't expand it here.
In addition, it's funny to say that when you first learn rules, you don't know how to match any text. Later, after some study, it was finally matched, in fact, it is also very simple, it is any combination of non-white space characters and white space characters: ([\ s\ S] *)
I would also like to remind you that if you want to do the tag form above, Dreamweaver also provides another more intuitive way, which I won't say much about, as you can see by selecting "specify tag" in the search option of "find and replace".
Summary: Dreamweaver provides very powerful find and replace capabilities. Flexible use of the various methods it provides will bring more convenience to the work.
Example:
Web page 1: teaching network cherishes students' independent reading page 2: teaching network to be a student who loves reading as above, I have a group of static web pages, all the same in the TITLE tag. I want to replace the title text in the TITLE tag in batches with the title text in the H2 tag. Excuse me, how to use DW regular expression batch operation!
Find
. *? ([\ s\ S] *?) (. *?)
Replace with
$2 $1 $1
Remember to check to use regular expressions
Making good use of Dreamweaver's regular expression search and replacement function can greatly accelerate our work efficiency!
Original search replace result
Original character: abc
Find regular: (ab) (c)
Replace the rule: $1 / 2
Results: ab-c
Example 2: it contains parentheses, single quotation marks, etc.
Find: href= "_ javascript:if\ (confirm\ ('(. *?)'\) window\ .location ='(. *?)'"
Replace: $1
Some time ago, when the website was revised, I needed to change some regularity of the original text. After looking for it for a long time, I collected several pieces of information about finding and replacing with regular expressions in DW. I would like to share as follows:
Open one or more web pages in Dreamweaver, click "Edit" > "find and replace" in the source code, and click to check the "regular expression" option:
1. Find or replace the tppabs= "..." of the web page The code.
Fill in tppabs= "[^"] * "in the" find "column and you can find or replace the tppabs="... "code of the web page.
two。 Find or replace the height code of the web table.
Fill in height= "\ d +" in the "find" column to find or replace the height code of the web form.
3. Find or replace the web background color code.
Fill in bgcolor= "[^"] * "in the" find "column to find or replace the background color code of the web page.
4. Find or replace the JS code for the web page.
Fill in the "find" field
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.