此主题相关图片如下:2021-03-21_213839.png
以下内容为程序代码:
1 Dim str As String = "2018年5月毕业于西安大学.2018/9就职于东方公司,2020-7-16在东方公司任销售经理,2021/5/28任销......"
2 Dim reg As New System.Text.RegularExpressions.Regex("(^[0-9]{2,4}[-|/|.|年]\d{1,2}[-|/|.|月]\d{0,2}[日]?)")
3 Dim dm As String ="[0-9]{2,4}[年|\/|\-|\.]?\d{1,2}[月|\/|\-|\.]\d{0,2}[日]?[\u4e00-\u9fa5]+[.|,]+"
4 Dim dm1 As String ="[0-9]{2,4}[年|\/|\-|\.]?\d{1,2}[月|\/|\-|\.]\d{0,2}[日]?"
5 Dim mc = System.Text.RegularExpressions.Regex.Matches(str,dm)
6 Dim nr,nr1,nr2 As String
7
8 For i As Integer =0 To mc.count-1
9 nr =mc(i).value
10 Dim mc1 = System.Text.RegularExpressions.regex.match(nr,dm1)
11 nr1=mc1.value
12 nr1=nr1.Replace("年","-").Replace("月","-").Replace("日","").Replace(".","-").Replace("/","-")
13 If not nr1.EndsWith("-") Then
14 nr1=nr1+"-"
15 End If
16 nr2=""
17 For Each s As String In nr1.Split("-")
18 Select Case s.Length
19 Case 4
20 nr2=nr2+format(cint(s),"0000")+"-"
21 Case 1,2
22 nr2=nr2+format(cint(s),"00")+"-"
23 Case 0
24 nr2=nr2+"01"
25 End Select
26
27 Next
28 If nr2.Length>10 Then
29 nr2=nr2.SubString(0,10)
30 End If
31 output.Show(nr2 & "," & nr.Replace(mc1.value,""))
32 Next
[此贴子已经被作者于2021/3/21 21:42:57编辑过]