regex class : Delete(string) method

Description

Gets a new string that deleted all strings that match a regular expression pattern in the argument.

Syntax

regexInstance.Delete(string source)

Arguments

ClassNameDescription
stringsourceA string which is searched.

Return value

ClassDescription
stringA new string that deleted all strings that match a regular expression pattern.

Sample code

1:

regex pattern = new regex("a+");

2:

string result = pattern.Delete("aaabbbaaccc"); // result is "bbbccc".

Notes

It's a wrapper of the System.Text.RegularExpressions.Regex.Replace(String,String) method.

Links for reference

Copyright © Cooker All rights reserved.