【发布时间】:2016-09-02 08:36:51
【问题描述】:
我需要将字符串中的“@”替换为“-”。这很简单,但我还需要用一个“-”替换多个“@@@@@”。关于如何用 ASP 做后者的任何想法。 这是一个例子:
输入字符串: @Introducción a los Esquemas Algorítmicos:Apuntes y colección de problemas。报告 LSI-97-6-T@@@@@@@@09/30/1997@@@@@TRE@
期望的输出: -Introducción a los Esquemas Algorítmicos: Apuntes y colección de problemas。报告 LSI-97-6-T-09/30/1997-TRE-
谢谢。
【问题讨论】:
-
你能举个例子说明目前对你没有用的东西吗?
-
旧的 ASP 或 ASP.NET?
-
那么问题是,如果我这样做: Replace(string,"@","-") 我会重复“-”,当多个“@”时我只想要一个“-”在输入字符串中找到。谢谢
-
您也只是指示将单个“@”替换为单个“-”。您需要查看正则表达式量词。 regular-expressions.info/repeat.html
-
实际上,DNKROZ 发布了 2 个答案并使用
@+正则表达式将其删除。我相信last one 可以做到。
标签: regex string replace character