When editing a Word document that contains both Chinese and English text, you may need to join lines, swap positions, or remove spaces between Chinese and English characters.

Swap the positions of Chinese and English text.
- Press Ctrl + H to open the Find and Replace dialog.
- Click the 'Advanced' button and check the 'Use wildcards' checkbox.
- In the 'Find what' field enter the following: ([一-龥]@)([a-zA-Z]@)^13
- In the 'Replace with' field enter the following: \\2\\1^p
- Click 'Replace All'.
This will remove all spaces between Chinese and English characters in the document.

Code explanation
The code ([一-龥]@)([a-zA-Z]@)^13 is used in the context of the 'Find and Replace' function in word processing software like Microsoft Word, particularly when dealing with documents containing both Chinese and English text.
Code component explanation
- ([一-龥]@):
- [一-龥]: This part specifies a range of characters. It matches any Chinese character from 一 to 龥. This range includes most common Chinese characters.
- @: This symbol is a wildcard that means 'one or more' of the preceding character(s). In this case, it represents one or more Chinese characters.
- ([a-zA-Z]@):
- [a-zA-Z]: This specifies a range of characters, including all lowercase and uppercase English letters (a to z and A to Z).
- @: As before, this wildcard means 'one or more' of the preceding character, so it matches one or more English letters.
- ^13:
- This denotes a line break (or end of line). In the context of Find and Replace, it is used to match the end of a line, indicating that the preceding characters (including Chinese and English) occur before a new line.
Summary
Putting it all together, the expression ([一-龥]@)([a-zA-Z]@)^13 is used to find instances in a document where one or more Chinese characters are followed by one or more English letters, and then followed by a line break.
The code \\2\\1^p is used in the context of the Find and Replace function in word processing software like Microsoft Word.
This code is typically part of the replacement string, specifying how to format text that matched a pattern defined in the earlier Find operation.
Let's break it down:
Code component explanation
- \2:
- This refers to the content captured by the second set of parentheses in the Find expression. In Find and Replace, each pair of parentheses creates a capture group that can be referenced later in the replacement string.
- For example, if the 'Find' expression was ([a-zA-Z]@)([一-龥]@), then \\2 would represent the part of the text that matched the second group (the Chinese characters).
- \1:
- This refers to the content captured by the first set of parentheses in the Find expression. Like \\2, it allows you to insert the captured content back into the replacement string.
- Continuing the above example, \1 represents the text matched by the first group (English letters).
- ^p:
- This indicates the paragraph mark (or newline) in the replacement string. It means a new line should be inserted after the replacement content.
- This is useful for formatting because it creates a new line in the document where the replacement occurs.
Summary
Overall, \2\1^p means that when a match is found (according to the 'Find' expression), the replacement will consist of:
- First, the contents of the second capture group (e.g., Chinese characters),
- Then, the contents of the first capture group (e.g., English letters),
- Then a new line (paragraph mark) will be added after this combined content.
W0001










