1

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.

1 Answer 1

1

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")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.