Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
457 views
in Technique[技术] by (71.8m points)

把“男:XXX女:XXXX男:XXX男:XXX女:XXXX”这种形式的字符串转变成数组

我想把“男:XXX女:XXXX男:XXX男:XXX女:XXXX”这种形式的字符串转变成 array(['sex'=>'男','content'=>''XXX],['sex'=>'女','content'=>''XXX],…)这种形式的数组,有什么好的思路么?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

正则?/(男|女):[^男女]+/g

image.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...