Remove dynamic text from a string

Hello,

I need to remove all the text from strings that starts with “PAGE” and ends with “LIST” including these two words.

For example I have the string : “This is PAGE 10 ON 996Best practices LIST with the following result”

My needed output is “This is with the following result”.

Thanks in advance!

Hi @darie.leolea

System.Text.RegularExpressions.Regex.Replace(Inputt, "PAGE(.*?)LIST", "").Trim()

use Split function
temp and temp should be array of string
assign activity
temp =“This is PAGE 10 ON 996Best practices LIST with the following result”.split(“PAGE”).tostring
temp1 = temp(1).tostring.split(“LIST”).tostring
Output = temp1(0).tostring

this should return you expected string dynamicall

Blockquote

Hi, you can also use below expression:

InputString.Replace(System.Text.RegularExpressions.Regex.Match(inputString, “PAGE.*?LIST”).Value, “”)

Hi @darie.leolea

Input= "This is PAGE 10 ON 996Best practices LIST with the following result"
Output= System.Text.RegularExpressions.Regex.Replace(Input, "[A-Z]+\s*\d+\s*[A-Z]+\s*[0-9A-Za-z]+\s*[a-z]+\s*[A-Z]+", "").Trim()

Hope it helps!!

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