使用ampscript在第n个定界线后从字符串中提取文本
我需要能够在第n个定界符之后从字符串中提取。 在这种情况下,定界符是 下划线 。
挑战在于,最后一个定界符可以在第二,第三,第四或第五位置
示例:
lb_ab_ab_bookingReminder_123-1-1-1S(第三位置)
>- )
lb_ab_booking_reminder_reminder_123-1-2-1s(第4位)
所需的输出:123-1-2-1S
谢谢
I need to be able to extract from a string after nth delimiter.
In this case, the delimiter is an underscore.
The challenge is that the last delimiter could be in the 2nd, 3rd,4th or 5th position
Example:
LB_AB_BookingReminder_123-1-2-1S (3rd position)
LB_AB_123-1-2-1S (2nd position)
LB_AB_Booking_Reminder_123-1-2-1S (4th position)
Output Needed: 123-1-2-1S
Thank You
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Using the RegExMatch() function may be your best bet:
Output:
Regex101 snippet:
ampscript tester: https://mcsnippets.herokuapp.com/s/f4wisqvc
Using the RegExMatch() function may be your best bet:
Output:
Regex101 snippet: https://regex101.com/r/DJeKjd/1
AMPscript tester: https://mcsnippets.herokuapp.com/s/F4WISQvc