Main Area and Open Discussion > General Software Discussion
Regular Expressions (help)
Contro:
--- Code: AutoIt ---#Region ;**** Directives created by AutoIt3Wrapper_GUI ****#AutoIt3Wrapper_UseUpx=n#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;$inclip = "***CONTRO*** February 28, 2010 at 5:18am";$inclip = '01.02.2010.05.18' HotKeySet('^#!2', '_Doit') ; Win+Alt+Ctrl+2 While 1 Sleep(1000)WEnd Exit Func _Doit() $inclip = ClipGet() If StringLeft($inclip, 12) <> '***CONTRO***' Then $outclip = StringRegExpReplace($inclip, '(..)\.(..)\.(....)\.0?(.+)\.(..)', '\1_\2_\3 , \4_\5') Else $outclip = _Valmorphanize(StringMid($inclip, 14)) EndIf ClipPut($outclip) Sleep(50) Send('^v')EndFunc Func _Valmorphanize($temp) Local $hour = StringLeft(StringRight($temp, 7), StringInStr(StringRight($temp, 7), ':') - 1) + (12 * (StringRight(StringRight($temp, 7), 2) = 'pm')) If Not Mod($hour, 12) Then $hour-=12 Return StringRegExpReplace($temp, '.+\b.\d+, (\d{4}).+:(\d{2}).*', StringFormat('%02s', StringRegExpReplace(StringMid($temp, StringInStr($temp, ' ') + 1, 2), '([,\s])', '')) & '_' & StringFormat('%02s', Int(StringInStr('JanFebMarAprMayJunJulAugSepOctNovDec', StringLeft($temp, 3), 1) / 3) + 1) & '_\1 , ' & $hour & '_\2')EndFunc-4wd (January 13, 2013, 04:58 AM)
--- End quote ---
Running to tryyyyy
:-*
Navigation
[0] Message Index
[*] Previous page
Go to full version