How can I tell if a string is double-spelled?

Source: Internet
Author: User
Tags ming
For example:

Alie//Yes
ALIEX//Not

Olai//Yes
Olain//Not

Oupai//Yes
Onpai//Not

Eiyuan//Yes
Eilo//Not

Yolai//Yes
Yoei//Yes

Of course I have a single spelling list, and the question is how to filter. People who do not know the programming are not thinking more and do not know how to start, can pay ...
Single-Spell list:

A ai an ang ao ba bai ban bang Bao bei ben Beng bi bian Biao bie bin Bing Bo bu ca cai can cang Cao ce cen ceng cha Chai C  Han Chang Chao che Chen Cheng Chi Chong Chou Chu Chua Chuai Chuan Chuang Chui chun Chuo ci cong cou cu cuan cui cun cuo da Dai Dan Dang Dao de den dei Deng di dia dian Diao die ding Diu dong dou du duan dui dun duo e ei en eng er fa fan Fang fe I fen feng fo fou fu ga gai gan gang gao ge gei gen Geng Gong Gou gu gua Guai Guan Guang gui gun guo Ha hai han hang hao h E Hei hen heng Hong Hou hu hua Huai Huan Huang Hui hun huo ji Jia Jian Jiang Jiao Jie Jin Jing jiong jiu ju Juan Jue June K A kai kan kang kao ke ken Keng Kong kou ku kua Kuai Kuan Kuang kui kun kuo la lai lan Lang lao le Lei Leng Li Lia Lian Lia  Ng Liao Lie Lin Ling Liu Long Lou lu Luan lue lun luo ma mai man mang Mao Me mei men meng mi mian miao Mie min Ming Miu mo MoU Mu na nai nan nang nao ne nei nen neng ni nian niang niao nie nin ning Niu Nong Nou Nu nuan nuo nun o ou pa Pai pan P Ang Pao pei Pen Peng PiPian Piao pie pin ping po pou pu qi qia qian Qiang qiao Qie Qin Qing qiong qiu qu Quan que Qun ran rang Rao re Ren reng ri Rong Rou ru Ruan Rui Run ruo sa sai San sang Sao se Sen Seng Sha Shai Shan Shang Shao she shei shen Sheng Shi Shou shu sh UA Shuai Shuan Shuang Shui Shun Shuo si song sou su suan sui sun suo ta tai Tan Tang tao te Teng ti tian Tiao tie ting ton  G tou Tu tuan tui Tun Tuo wa Wai Wan Wang Wei Wen weng wo Wu Xi Xia xian xiang Xiao Xie Xin Xing Xiong Xiu Xu Xuan Xue Xun Ya Yan yang yao ye yi Yin Ying yo yong you yu Yuan Yue Yun za zai zan zang zao ze zei zen Zeng Zha Zhai Zhan Zhang Zhao Z He zhei Zhen Zheng Zhi zhong Zhou Zhu Zhua zhuai zhuan Zhuang zhui Zhun Zhuo Zi Zong Zou zu zuan Zui Zun Zuo

Reply content:

For example:

Alie//Yes
ALIEX//Not

Olai//Yes
Olain//Not

Oupai//Yes
Onpai//Not

Eiyuan//Yes
Eilo//Not

Yolai//Yes
Yoei//Yes

Of course I have a single spelling list, and the question is how to filter. People who do not know the programming are not thinking more and do not know how to start, can pay ...
Single-Spell list:

A ai an ang ao ba bai ban bang Bao bei ben Beng bi bian Biao bie bin Bing Bo bu ca cai can cang Cao ce cen ceng cha Chai C  Han Chang Chao che Chen Cheng Chi Chong Chou Chu Chua Chuai Chuan Chuang Chui chun Chuo ci cong cou cu cuan cui cun cuo da Dai Dan Dang Dao de den dei Deng di dia dian Diao die ding Diu dong dou du duan dui dun duo e ei en eng er fa fan Fang fe I fen feng fo fou fu ga gai gan gang gao ge gei gen Geng Gong Gou gu gua Guai Guan Guang gui gun guo Ha hai han hang hao h E Hei hen heng Hong Hou hu hua Huai Huan Huang Hui hun huo ji Jia Jian Jiang Jiao Jie Jin Jing jiong jiu ju Juan Jue June K A kai kan kang kao ke ken Keng Kong kou ku kua Kuai Kuan Kuang kui kun kuo la lai lan Lang lao le Lei Leng Li Lia Lian Lia  Ng Liao Lie Lin Ling Liu Long Lou lu Luan lue lun luo ma mai man mang Mao Me mei men meng mi mian miao Mie min Ming Miu mo MoU Mu na nai nan nang nao ne nei nen neng ni nian niang niao nie nin ning Niu Nong Nou Nu nuan nuo nun o ou pa Pai pan P Ang Pao pei Pen Peng PiPian Piao pie pin ping po pou pu qi qia qian Qiang qiao Qie Qin Qing qiong qiu qu Quan que Qun ran rang Rao re Ren reng ri Rong Rou ru Ruan Rui Run ruo sa sai San sang Sao se Sen Seng Sha Shai Shan Shang Shao she shei shen Sheng Shi Shou shu sh UA Shuai Shuan Shuang Shui Shun Shuo si song sou su suan sui sun suo ta tai Tan Tang tao te Teng ti tian Tiao tie ting ton  G tou Tu tuan tui Tun Tuo wa Wai Wan Wang Wei Wen weng wo Wu Xi Xia xian xiang Xiao Xie Xin Xing Xiong Xiu Xu Xuan Xue Xun Ya Yan yang yao ye yi Yin Ying yo yong you yu Yuan Yue Yun za zai zan zang zao ze zei zen Zeng Zha Zhai Zhan Zhang Zhao Z He zhei Zhen Zheng Zhi zhong Zhou Zhu Zhua zhuai zhuan Zhuang zhui Zhun Zhuo Zi Zong Zou zu zuan Zui Zun Zuo

By consulting a lot of experts, basically can use.

$pattern = '/^ ((a) | ( AI) | (AN) | (ANG) | (AO) | (BA) | (BAI) | (BAN) | (Bang) | (Bao) | (bei) | (Ben) | (Beng) | (BI) | (Bian) | (Biao) | (BIE) | (BIN) | (Bing) | (bo) | (BU) | (CA) | (CAI) | (CAN) | (Cang) | (CAO) | (CE) | (CEN) | (CEng) | (CHA) | (CHAI) | (chan) | (Chang) | (Chao) | (che) | (Chen) | (Cheng) | (CHI) | (Chong) | (Chou) | (CHU) | (Chua) | (Chuai) | (Chuan) | (Chuang) | (Chui) | (Chun) | (Chuo) | (CI) | (Cong) | (COU) | (CU) | (Cuan) | (cui) | (CUN) | (CuO) | (DA) | (DAI) | (Dan) | (dang) | (dao) | (DE) | (DEN) | (DEI) | (Deng) | (DI) | (DIA) | (dian) | (Diao) | (Die) | (ding) | (Diu) | (Dong) | (Dou) | (DU) | (Duan) | (DUI) | (DUN) | (duo) | (e) | (EI) | (en) | (ENG) | (er) | (FA) | (fan) | (Fang) | (FEI) | (FEN) | (Feng) | (FO) | (fou) | (FU) | (GA) | (gai) | (Gan) | (gang) | (GAO) | (GE) | (GEi) | (Gen) | (Geng) | (gong) | (Gou) | (gu) | (GUA) | (Guai) | (Guan) | (Guang) | (GUI) | (gun) | (Guo) | (ha) | (HAI) | (han) | (hang) | (Hao) | (HE) | (HEI) | (hen) | (Heng) | (Hong) | (HOU) | (HU) | (Hua) | (Huai) | (Huan) | (Huang) | (hui) | (HUN) | (Huo) | (JI) | (Jia) | (Jian) | (Jiang) | (Jiao) | (Jie) | (Jin) | (jing) | (Jiong) | (JIU) | (JU) | (Juan) | (Jue) | (June) | (KA) | (kai) | (kan) | (Kang) | (kao) | (KE) | (KEN) | (Keng) | (KONG) | (Kou) | (KU) | (Kua) | (Kuai) | (Kuan) |(Kuang) | (Kui) | (kun) | (Kuo) | (LA) | (LAI) | (LAN) | (lang) | (Lao) | (LE) | (LEI) | (Leng) | (LI) | (LIA) | (Lian) | (Liang) | (Liao) | (Lie) | (Lin) | (ling) | (Liu) | (Long) | (Lou) | (LU) | (Luan) | (Lue) | (LUN) | (Luo) | (MA) | (mai) | (man) | (Mang) | (MAO) | (Me) | (MEI) | (men) | (Meng) | (MI) | (Mian) | (Miao) | (mie) | (min) | (Ming) | (MIU) | (MO) | (MOU) | (MU) | (NA) | (NAI) | (Nan) | (Nang) | (NAO) | (NE) | (nei) | (nen) | (Neng) | (NI) | (Nian) | (Niang) | (Niao) | (NIE) | (NIN) | (ning) | (NIU) | (Nong) | (NOU) | (NU) | (Nuan) | (Nuo) | (nun) | (o) | (OU) | (PA) | (PAI) | (PAN) | (Pang) | (PAO) | (PEI) | (pen) | (Peng) | (PI) | (Pian) | (Piao) | (PIE) | (PIN) | (ping) | (PO) | (POU) | (PU) | (QI) | (QIA) | (Qian) | (Qiang) | (QIAO) | (Qie) | (Qin) | (Qing) | (Qiong) | (Qiu) | (qu) | (Quan) | (que) | (Qun) | (RAN) | (rang) | (Rao) | (RE) | (ren) | (Reng) | (RI) | (Rong) | (ROU) | (RU) | (Ruan) | (RUI) | (run) | (Ruo) | (SA) | (SAI) | (SAN) | (Sang) | (SAO) | (SE) | (SEN) | (Seng) | (SHA) | (Shai) | (shan) | (Shang) | (Shao) | (She) | (Shei) | (shen) | (Sheng) | (shi) | (Shou) | (SHU) | (Shua) | (Shuai) | (Shuan) | (Shuang) | (Shui) | (Shun) | (Shuo) | (SI) | (song) | (SOU) | (SU) | (Suan) | (SUI) | (Sun) | (suo) | (TA) | (Tai) | (TAN) | (Tang) | (TAO) | (TE) | (Teng) | (TI) | (TiAN) | (Tiao) | (tie) | (ting) | (Tong) | (TOU) | (TU) | (Tuan) | (TUI) | (tun) | (Tuo) | (WA) | (WAI) | (WAN) | (Wang) | (WEI) | (Wen) | (Weng) | (wo) | (WU) | (xi) | (Xia) | (Xian) | (Xiang) | (Xiao) | (XIE) | (xin) | (xing) | (xiong) | (Xiu) | (Xu) | (Xuan) | (xue) | (Xun) | (ya) | (yan) | (Yang) | (Yao) | (Ye) | (Yi) | (yin) | (Ying) | (yo) | (Yong) | (You) | (Yu) | (Yuan) | (Yue) | (Yun) | (za) | (ZAI) | (Zan) | (Zang) | (Zao) | (Ze) | (Zei) | (Zen) | (Zeng) | (Zha) | (Zhai) | (Zhan) | (Zhang) | (Zhao) | (ZHE) | (Zhei) | (zhen) | (Zheng) | (zhi) | (Zhong) | (Zhou) | (Zhu) | (Zhua) | (Zhuai) | (Zhuan) | (Zhuang) | (Zhui) | (Zhun) | (Zhuo) | (Zi) | (zong) | (Zou) | (zu) | (Zuan) | (Zui) | (Zun) | (Zuo)) {2}$/';

$file = file_get_contents ("Domain.txt", "R");
$shuangpin =array ();
$qita =array ();
$lines = explode ("\ n", $file);
foreach ($lines as $values) {
if (Preg_match ($pattern, $values)) {
$shuangpin [] = $values;
} else {
$qita [] = $values;
}
}
$shuangpin = implode ("\ n", $shuangpin);
$qita = implode ("\ n", $qita);

File_put_contents (' Shuangpin.txt ', $shuangpin);
File_put_contents (' Qita.txt ', $qita);
?>

  • Related Article

    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.