* Example generated by -dataex-. For more info, type help dataex
clear
input str252 A
"王亚变 %A 薛丽洋 %A 刘佳 %A 王金相"
"付丽亚 %A 宋玉栋 %A 王盼新 %A 赵檬 %A 黄琪 %A 席宏波 %A 于茵 %A 吴昌永"
"苑鹏"
"杨春月 %A 李莉 %A 马诗淇 %A 翟永杰 %A 周静逸 %A 陈徐彬"
"陆曦 %A 梅凯"
"柴大华 %A 金珊 %A 杨菲 %A 王晶"
"匡翠萍 %A 邢飞 %A 刘曙光 %A 娄厦 %A 贺露露 %A 邓凌"
"付俊娥 %A 田宏红 %A 李纪人"
"梁建奎 %A 龙岩 %A 郭爽"
"王福进"
"郭爽 %A 龙岩 %A 李有明 %A 杨艺琳 %A 龙策"
"陈娜日苏"
"汪杰 %A 杨青 %A 黄艺 %A 蔡佳亮"
"何进朝 %A 李嘉"
"张雯欢 %A 吴彦"
"孙东迁 %A 周孝德 %A 曹永中"
"钟声 %A 郁建桥 %A 徐亮"
"张佩 %A 贾振兴 %A 郑秀清 %A 张旭阳"
"卢滨 %A 陈义中 %A 常文婷"
"陈义中"
"龙岩 %A 李有明 %A 孔令仲 %A 朱杰"
"邓宇杰 %A 刘伟"
"吴凤平 %A 朱晓娜 %A 程铁军"
"方航 %A 胡玮 %A 胡琳"
"张晶晶"
end
[/CODE]
How to extract the target string
How to extract the name before the first %A, and extract the name after the last %A
I know there should be at least 3 ways:
Combining the ustrregexs and ustrregexm functions is one way
Combining ends function and punct function is one way
moss command is one way
But I can only achieve the goal with the ends function and the punct function, other methods, can anyone provide guidance?
clear
input str252 A
"王亚变 %A 薛丽洋 %A 刘佳 %A 王金相"
"付丽亚 %A 宋玉栋 %A 王盼新 %A 赵檬 %A 黄琪 %A 席宏波 %A 于茵 %A 吴昌永"
"苑鹏"
"杨春月 %A 李莉 %A 马诗淇 %A 翟永杰 %A 周静逸 %A 陈徐彬"
"陆曦 %A 梅凯"
"柴大华 %A 金珊 %A 杨菲 %A 王晶"
"匡翠萍 %A 邢飞 %A 刘曙光 %A 娄厦 %A 贺露露 %A 邓凌"
"付俊娥 %A 田宏红 %A 李纪人"
"梁建奎 %A 龙岩 %A 郭爽"
"王福进"
"郭爽 %A 龙岩 %A 李有明 %A 杨艺琳 %A 龙策"
"陈娜日苏"
"汪杰 %A 杨青 %A 黄艺 %A 蔡佳亮"
"何进朝 %A 李嘉"
"张雯欢 %A 吴彦"
"孙东迁 %A 周孝德 %A 曹永中"
"钟声 %A 郁建桥 %A 徐亮"
"张佩 %A 贾振兴 %A 郑秀清 %A 张旭阳"
"卢滨 %A 陈义中 %A 常文婷"
"陈义中"
"龙岩 %A 李有明 %A 孔令仲 %A 朱杰"
"邓宇杰 %A 刘伟"
"吴凤平 %A 朱晓娜 %A 程铁军"
"方航 %A 胡玮 %A 胡琳"
"张晶晶"
end
[/CODE]
How to extract the target string
How to extract the name before the first %A, and extract the name after the last %A
I know there should be at least 3 ways:
Combining the ustrregexs and ustrregexm functions is one way
Combining ends function and punct function is one way
moss command is one way
But I can only achieve the goal with the ends function and the punct function, other methods, can anyone provide guidance?

Comment