# A rule to identify spaces between Chinese

**URL:** <https://forum.xbench.net/t/a-rule-to-identify-spaces-between-chinese/616>\
**Category:** Technical Support\
**Created:** [June 18, 2020, 8:49am UTC](https://forum.xbench.net/t/a-rule-to-identify-spaces-between-chinese/616 "2020-06-18T08:49:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![wangximin](https://avatars.discourse-cdn.com/v4/letter/w/ec9cab/32.png) [@wangximin](https://forum.xbench.net/u/wangximin)\
**Post date:** [June 18, 2020, 8:49am UTC](https://forum.xbench.net/t/a-rule-to-identify-spaces-between-chinese/616/1 "2020-06-18T08:49:45Z")

</div>

Hi there!  
Could you please provide a rule or regex to indentify the extra spaces between Chinese words.  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![omartin](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.xbench.net/omartin/32/82_2.png) [@omartin](https://forum.xbench.net/u/omartin)\
**Post date:** [June 18, 2020, 9:59am UTC](https://forum.xbench.net/t/a-rule-to-identify-spaces-between-chinese/616/2 "2020-06-18T09:59:52Z")

</div>

Hi,

The following rule will help you identify more than 1 space between Chinese characters:

Source or target term: `[\x4E00-\x9FFF\x3400-\x4DBF\x20000-\x2A6DF\x2A700-\x2B73F\x2B740-\x2B81F\x2B820-\x2CEAF\x2CEB0-\x2EBEF\x30000-\x3134F\xF900-\xFAFF\x2F800-\x2FA1F][:space:]{2,}[\x4E00-\x9FFF\x3400-\x4DBF\x20000-\x2A6DF\x2A700-\x2B73F\x2B740-\x2B81F\x2B820-\x2CEAF\x2CEB0-\x2EBEF\x30000-\x3134F\xF900-\xFAFF\x2F800-\x2FA1F]`  
Search mode: regular expressions

To find any space between Chinese characters, use this other rule:

Source or target term: `[\x4E00-\x9FFF\x3400-\x4DBF\x20000-\x2A6DF\x2A700-\x2B73F\x2B740-\x2B81F\x2B820-\x2CEAF\x2CEB0-\x2EBEF\x30000-\x3134F\xF900-\xFAFF\x2F800-\x2FA1F][:space:][\x4E00-\x9FFF\x3400-\x4DBF\x20000-\x2A6DF\x2A700-\x2B73F\x2B740-\x2B81F\x2B820-\x2CEAF\x2CEB0-\x2EBEF\x30000-\x3134F\xF900-\xFAFF\x2F800-\x2FA1F]`  
Search mode: regular expressions

Best regards,  
Oscar.

---

<div class="post-metadata">

**Author:** ![wangximin](https://avatars.discourse-cdn.com/v4/letter/w/ec9cab/32.png) [@wangximin](https://forum.xbench.net/u/wangximin)\
**Post date:** [June 18, 2020, 11:10am UTC](https://forum.xbench.net/t/a-rule-to-identify-spaces-between-chinese/616/3 "2020-06-18T11:10:04Z")

</div>

> [@omartin](#):
>
> [\x4E00-\x9FFF\x3400-\x4DBF\x20000-\x2A6DF\x2A700-\x2B73F\x2B740-\x2B81F\x2B820-\x2CEAF\x2CEB0-\x2EBEF\x30000-\x3134F\xF900-\xFAFF\x2F800-\x2FA1F][:space:][\x4E00-\x9FFF\x3400-\x4DBF\x20000-\x2A6DF\x2A700-\x2B73F\x2B740-\x2B81F\x2B820-\x2CEAF\x2CEB0-\x2EBEF\x30000-\x3134F\xF900-\xFAFF\x2F800-\x2FA1F]

Dear Oscar,  
Thanks for your quick reponse!  
Here is my test result.  
Lowest resource  
最低 资源要求  
The expression really works!  
But I like to avoid the English sentences or the sentences like “可以查看 PatchDeployment 资源”, just focusing Chinese without any English! Could you please help again?  
BR  
Wang Ximin

---

<div class="post-metadata">

**Author:** ![omartin](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.xbench.net/omartin/32/82_2.png) [@omartin](https://forum.xbench.net/u/omartin)\
**Post date:** [June 18, 2020, 1:29pm UTC](https://forum.xbench.net/t/a-rule-to-identify-spaces-between-chinese/616/4 "2020-06-18T13:29:53Z")

</div>

Hi Wang,

The regular expression does not detect spaces between Chinese and Latin characters.

The following regular expression should detect segments with spaces between Chinese characters but that do not contain Latin characters.

`"[\x4E00-\x9FFF\x3400-\x4DBF\x20000-\x2A6DF\x2A700-\x2B73F\x2B740-\x2B81F\x2B820-\x2CEAF\x2CEB0-\x2EBEF\x30000-\x3134F\xF900-\xFAFF\x2F800-\x2FA1F][:space:][\x4E00-\x9FFF\x3400-\x4DBF\x20000-\x2A6DF\x2A700-\x2B73F\x2B740-\x2B81F\x2B820-\x2CEAF\x2CEB0-\x2EBEF\x30000-\x3134F\xF900-\xFAFF\x2F800-\x2FA1F]" - "<[a-z]{2,}>"`  
Search mode: Regular Expressions  
PowerSearch: On

Best regards,  
Òscar.

---

<div class="post-metadata">

**Author:** ![wangximin](https://avatars.discourse-cdn.com/v4/letter/w/ec9cab/32.png) [@wangximin](https://forum.xbench.net/u/wangximin)\
**Post date:** [June 19, 2020, 12:06am UTC](https://forum.xbench.net/t/a-rule-to-identify-spaces-between-chinese/616/5 "2020-06-19T00:06:32Z")

</div>

Hi Òscar,  
Thanks a million.

Best Regards  
Wang Ximin

---

<div class="post-metadata">

**Author:** ![wangximin](https://avatars.discourse-cdn.com/v4/letter/w/ec9cab/32.png) [@wangximin](https://forum.xbench.net/u/wangximin)\
**Post date:** [June 19, 2020, 2:30am UTC](https://forum.xbench.net/t/a-rule-to-identify-spaces-between-chinese/616/6 "2020-06-19T02:30:40Z")

</div>

Hi Òscar,  
You are awesome!  
And could you please provide a reglular expression to help detect if blank spaces are missing.  
Just like this: 谢谢您帮我解决第1个问题。which should be 谢谢您帮我解决第 1 个问题。 that is to say, there should be spaces around a non-Chinese character. Many thanks!

Best Regards  
Wang Ximin

---

<div class="post-metadata">

**Author:** ![omartin](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.xbench.net/omartin/32/82_2.png) [@omartin](https://forum.xbench.net/u/omartin)\
**Post date:** [June 19, 2020, 8:05am UTC](https://forum.xbench.net/t/a-rule-to-identify-spaces-between-chinese/616/7 "2020-06-19T08:05:30Z")

</div>

This regex should help you find any missing spaces before or after numbers or Latin characters.

`[^a-z0-9[:space:]][a-z0-9]+ OR [a-z0-9][^[:space:]a-z0-9]`  
Search mode: Regular Expressions.  
PowerSearch: On.

---

<div class="post-metadata">

**Author:** ![x69toki](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.xbench.net/x69toki/32/249_2.png) [@x69toki](https://forum.xbench.net/u/x69toki)\
**Post date:** [November 18, 2020, 6:41am UTC](https://forum.xbench.net/t/a-rule-to-identify-spaces-between-chinese/616/8 "2020-11-18T06:41:41Z")

</div>

Thanks for the updates. 🙂
