Reputation: 31
In my application, when the user enters, for example, a parameters named : DateSTA (STA stands for START) an other parameters is automaticaly added with the name "DateEND".
So, in my application, I check if the parameter entred ends with "STA" so I launch the code for creating the other parameters automaticaly.
If namePara.EndsWith("STA") Then
Dim nameEnd as string = Regex.Replace(namePara, "******", "END", RegexOptions.None)
To do it, I need a regex (the * in the code) that searches the "STA" in a string and replace it with "END"
Thanks in advance.
Upvotes: 1
Views: 927
Reputation: 149020
You could just do this:
Dim nameEnd as String = namePara.Remove(namePara.Length - 3) & "END"
But if you must use Regex:
Dim nameEnd as String = Regex.Replace(namePara, "STA$", "END")
Upvotes: 1