Search notes:

System.Text.RegularExpressions.Regex - Replace()

Overloads

public static string Replace (string input, string pattern, string replacement);
public static string Replace (string input, string pattern, string replacement, System.Text.RegularExpressions.RegexOptions options, TimeSpan matchTimeout);

public static string Replace (string input, string pattern, System.Text.RegularExpressions.MatchEvaluator evaluator);
public static string Replace (string input, string pattern, System.Text.RegularExpressions.MatchEvaluator evaluator, System.Text.RegularExpressions.RegexOptions options);
public static string Replace (string input, string pattern, System.Text.RegularExpressions.MatchEvaluator evaluator, System.Text.RegularExpressions.RegexOptions options, TimeSpan matchTimeout);

public        string Replace (string input, System.Text.RegularExpressions.MatchEvaluator evaluator, int count, int startat);

public        string Replace (string input, string replacement, int count);

PowerShell example

The following PowerShell example replaces the text from the first character to and including the first line that starts with BEGIN:
$txt = @'
one two three
four BEGIN five
six seven eight nine
BEGIN
abc defghi jklm no
pq BEGIN rstu
vwx yz
BEGIN
hello world
BEGIN
end.
'@

[regex] $pat = '(?ms).*?^BEGIN\n?'

$repl = $pat.Replace($txt, '', 1)
">$repl<"
Note that this example enables multiline and singlemode mode with (?ms) so that ^ matches the beginning of a line within the input string and . matches new lines as well.

See also

System.Text.RegularExpressions.Regex

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Microsof...', 1759398029, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Microsoft/dot-net/namespaces-classes/System/Text/RegularExpressions/Regex/Replace/index(73): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78