A few examples of commonly used re regular expressions are:
1 ImportRE
2 3m = Re.match ("ABC","abcdef")4 Print(M.group ())#output: ABC5m = Re.match ("[0-9][0-9]","75ab6cdef")6 Print(M.group ())#Output:7m = Re.match ("[0-9]{0,10}","75ab6cdef")8 Print(M.group ())#Output:9m = Re.findall ("[0-9]{1,10}","123124fsdfsf28")Ten Print(m)#output: [' 123124 ', ' ['] Onem = Re.findall ("[a-za-z]{1,10}","123124FSDFSF28FSDFSGG5DFSFDS3") A Print(m)#output: [' FSDFSF ', ' fsdfsgg ', ' Dfsfds '] -m = Re.findall (".*","123124FSDFSF28FSDFSGG5DFSFDS3") - Print(m)#output: [' 123124fsdfsf28fsdfsgg5dfsfds3 ', '] them = Re.findall (".","123FSF28FSG5DFSDS3") - Print(m)#output: [' 1 ', ' 2 ', ' 3 ', ' f ', ' s ', ' f ', ' 2 ', ' 8 ', ' f ', ' s ', ' G ', ' 5 ', ' d ', ' f ', ' s ', ' d ' , ' s ', ' 3 '] -m = Re.findall (".+","123124FSDF~SF28.FSDF_SGG5DFSFDS3") - Print(m)#output: [' 123124fsdf~sf28.fsdf_sgg5dfsfds3 '] +m = Re.search ("\d+","AAA123124FSDF~SF28.FSDF_SGG5DFSFDS3") - Print(M.group ())#Output: 1 +m = Re.sub ("\d+","|","Fsdf~sf28.fs DF_SGG5DFSFDS3") A Print(m)#output: fsdf~sf|. FS Df_sgg| dfsfds| atm = Re.sub ("\d+","|","Fsdf~sf28.fs DF_SGG5DFSFDS3", Count=1) - Print(m)#output: fsdf~sf|. FS DF_SGG5DFSFDS3
"Python" re-regular expression