Home > Net > How to replace content with a regular expression
How to replace content with a regular expression
Time:02-17
CodePudding user response:
(0 | \ d {1, 2} | 100) (\ d +) \ \ s + d (\ \) 2=(\ w +) Respectively in three groups (1, 2, 3) corresponding: scores, student id, name
CodePudding user response:
Private Sub Button1_Click (sender As Object, As EventArgs e) Handles for. Click Dim STR As String="9901 d (01)=threes 88101 d (101)=wu3 da4 lang2 Adsfd Amplifier amplification " Dim the MC As System. Text. RegularExpressions. MatchCollection=System. Text. RegularExpressions.. Regex Matches (STR, "(0 | \ d {1, 2} | 100) (\ d +) \ \ s + d (\ \) 2=(\ w +)") For Each m the As System. Text. RegularExpressions. Match the MC In MessageBox. Show (" name: "+ m.G roups. (3) the Value + Environment. The NewLine +" student id: "+ m.G roups. (2) the Value + Environment. The NewLine +" score: "+ m.G roups (1). The Value) Next End Sub