search

Home  >  Q&A  >  body text

How to use php to separate phone number, name, address in string

The current demand is like this. The characters submitted by the other party may have the following three situations:

1.

Name: Hello everyone

Phone: 13131313130

Address: East of Tobacco Bureau, Xihua County, Zhoukou City, Henan Province Neighboring Alley

2,

Hello everyone

13131313130

Alley east of Xihua County Tobacco Bureau, Zhoukou City, Henan Province

3,

Hello everyone, 13131313130. East adjacent alley of Xihua County Tobacco Bureau, Zhoukou City, Henan Province

The third string may be separated by a period, a space, or other symbols. Now it does not matter the above three types. In any format, you can directly extract the name, phone number, and address. When exporting, you can implement it in the corresponding column in excel. How can you achieve this operation? Thanks!

phpcn_u1855phpcn_u18552811 days ago1121

reply all(1)I'll reply

  • PHP中文网

    PHP中文网2017-05-10 09:00:26

    Use regular expression matching.

    reply
    1
  • Cancelreply