Replace the rows starting with a fixed format in a Word document.

Source: Internet
Author: User

1. wildcard.

For example, to replace all rows starting with // del

 

// Del * ^ 13 {1}

Why not input the replacement?

([^ 11 ^ 13]) {1}
Match a CIDR Block character (^ 13, which is obtained by entering enter directly in the document) or a line break in the CIDR Block (^ 11, obtained by entering SHIFT + enter in the document ). Square brackets match any character in the Set in square brackets. "{N}" indicates matching n times, so "{1}" indicates matching once. As for the parentheses, they have the same functions as the parentheses mentioned above. I think they are redundant here.

By default, JavaScript is greedy. Which of the following must be added for the minimum matching of Java regular expressions? . Wildcard characters in Word documents are matched in non-Greedy mode.

 

 

2. VBA programming method.

Procedure 1:

Sub test ()

Selection. homekey wdstory

With selection. Find

. Clearformatting

'This example removes the format restriction from the search criteria before searching for the selected content.

Do while. Execute (findtext: = "del //")

. Parent. bookmarks ("\ line"). range. Delete 'indicates a continuous area in the document. Each range object is defined by a starting character position and a ending character position.

Loop

End

End sub

Procedure 2

Sub kill ()

For 1 to 500

Selection. find. execute findtext: = "del //", forward: = true, wrap: = wdfindcontinue 'If the prompt is not from the beginning of the text, when the end of the text is found, whether to continue from the beginning of the text to find the start of the 'position, wdfindstop.

If selection. Find. Found = true then

Selection. homekey

Selection. endkey extend: = true

Selection. Delete

End if

Next I

End sub

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.