x Did you like it? Well, then please consider making a donation :)

Simple Regex.Replace sample - add for word gmail.com

From MSDN: Regex.Replace processes text replacements. It handles simple replacements and more complex ones.

Tags: #login, #mail, #replace, #text. Views: 3228. admin, 3/30/2015
Link 1: http://www.systemtextregularexpressions.com/r3/simple-regex.replace-sample-add-for-word-gmail.com
Link 2: http://www.systemtextregularexpressions.com/r3 (short)


Length: 0b, Line: 1, Cursor: 0

RegexOptions

IsMatch=true

Result

login@gmail.com text@gmail.com user@gmail.com failed@gmail.com check@gmail.com newline@gmail.com fix@gmail.com sample@gmail.com example@gmail.com word@gmail.com regex@gmail.com mail@gmail.com match123@gmail.com split1@gmail.com@!@!@!@split2@gmail.com

Share (without adding to database):

Source code

0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
//.NET Regex.Replace Online Tester: www.systemtextregularexpressions.com

//Namespace
using System.Text.RegularExpressions;

//Regex Pattern
string pattern = @"\b[a-z]\w+";

//Regex example #1
Regex r = new Regex(@"\b[a-z]\w+");
string result1 = r.Replace("input text", "replacement text");

//Regex example #2
string result2 = Regex.Replace("input text", @"\b[a-z]\w+", "replacement text");
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
'.NET Regex.Replace Online Tester: www.systemtextregularexpressions.com

'Namespace
Imports System.Text.RegularExpressions

'Regex Pattern
Dim pattern As String = "\b[a-z]\w+"

'Regex example #1
Dim r As Regex = New Regex("\b[a-z]\w+")
Dim result1 As String = r.Replace("input text", "replacement text")

'Regex example #2
Dim result2 As String = Regex.Replace("input text", "\b[a-z]\w+", "replacement text")