Substring or remove

Am getting stuck in string manipulation
I have three sentence such as 1.“Sam opened Trust October 31, 2018” ,2.“it is when November 30, 2018”, 3.“thony December 31,2018” in above the three sentences i have i like to remove the month, date and year from that difference sentence is there any possible way pls give some idea to crack this.


1 Like


Use can use regex to remove the required portion from the string.

Try the below.

In Assign activity

result_string = System.Text.RegularExpressions.Regex.Replace(INPUT_STRING, “(Jan(uary)?|Feb(ruary)?|Mar(ch)?|Apr(il)?|May|Jun(e)?|Jul(y)?|Aug(ust)?|Sep(tember)?|Oct(ober)?|Nov(ember)?|Dec(ember)?)\s*(\d{1,2}\s*,\s*\d{4})”, “”)

Replace INPUT_STRING with your string.



About to type the same.


@KarthikByggari :grinning::grinning:

Thanks Dude working fine i need to know the explanation for this pls…


1 Like


I have used regular expression to remove the required pattern.

I will explain about the pattern used for your case.

Pattern : (Jan(uary)?|Feb(ruary)?|Mar(ch)?|Apr(il)?|May|Jun(e)?|Jul(y)?|Aug(ust)?|Sep(tember)?|Oct(ober)?|Nov(ember)?|Dec(ember)?)\s*(\d{1,2}\s*,\s*\d{4})

Example : it is when November 30, 2018

(Jan(uary)?|Feb(ruary)?|Mar(ch)?|Apr(il)?|May|Jun(e)?|Jul(y)?|Aug(ust)?|Sep(tember)?|Oct(ober)?|Nov(ember)?|Dec(ember)?) - Will check for the month name which can be first three characters(Jan) or full name (January)

Ex : (November will be matched for the above example)

\d{1,2} - Will match number with 1 or 2 digits (30 - will be matched)

\d{4} - match for 4 digit number (2018 will be matched)

\s - matches empty space

* - represent zero or more occurrence.

For detailed understanding about regular expression please go the below document.
Regular-Expressions.pdf (920.0 KB)

1 Like

Thank you so much @ranjith i clearly understood what you done.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.