Jump to content

mikell

MVPs
  • Posts

    3,849
  • Joined

  • Days Won

    63

mikell last won the day on February 13 2023

mikell had the most liked content!

About mikell

Profile Information

  • Member Title
    RIP: Soulful cat

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

mikell's Achievements

  1. It should... But as _IE* funcs are efficient and reliable but slow, when it is possible I personally often choose the string/regex way $txt = "<tr class=""web-row-style"">" & @crlf & _ " <td>1</td>" & @crlf & _ " <td>24/12/2023 09:33:21</td>" & @crlf & _ " <td>55801</td> " & @crlf & _ " </tr>" & @crlf & _ @crlf & _ @crlf & _ "<tr class=""web-alternating-row"">" & @crlf & _ " <td>2</td>" & @crlf & _ " <td>24/12/2023 08:51:30</td>" & @crlf & _ " <td>48887</td>" & @crlf & _ " </tr>" & @crlf & _ @crlf & _ "<tr class=""web-row-style"">" & @crlf & _ " <td>3</td>" & @crlf & _ " <td>23/12/2023 10:51:32</td>" & @crlf & _ " <td>289261</td> " & @crlf & _ " </tr>" ; Msgbox(0,"", $txt) $id = "48887" $res = StringRegExpReplace($txt, '(?s).*<td>(.*?)</td>\s*<td>' & $id & '</td>.*', "$1") Msgbox(0,"", @extended = 0 ? "id not found" : $res)
  2. Sorry, while my snippet works I didn't test yours #include <Date.au3> $sDateTime = "25/12/2023 14:59:30" $res = Execute("'" & StringRegExpReplace($sDateTime, "(\d+)/(\d+)/(\d+) (\d+):(\d+).*", _ "' & _DateToMonth('$2',1) & ' $1 $3 ' & ('$4'>12 ? StringFormat('%02i', '$4'-12) & ':$5PM' : '$4:$5AM') & '") & "'") Msgbox(0,"", $res)
  3. You might also try the screwy way - meaning regex (what else ?) #include <Date.au3> $sDateTime = "25/12/2023 18:50:30" $res = Execute("'" & StringRegExpReplace($sDateTime, "(\d+)/(\d+)/(\d+) (\d+):(\d+).*", _ "' & _DateToMonth('$2',1) & ' $1 $3 ' & ('$4'>12 ? StringFormat('%02i', '$4'-12) & ':$5PM' : '$4:$5AM') & '") & "'") Msgbox(0,"", $res)
  4. Even if the UDF doesn't allow to make your custom conversion in one go, it's certainly doable using several successive steps
  5. Exactly what I meant. Using _IETableWriteToArray you get a 2D array which contains DateTime and the corresponding User ID on the same rows
  6. For this I highly suggest to use the Melba's UDF , Musachi provided the link some posts above
  7. Personally I'd rather try something like this Local $oTds = _IETableGetCollection($oIE) For $oTd In $oTds $table = _IETableWriteToArray($oTd) _ArrayDisplay($table) Next and get a 2D array to work with
  8. You might try this - the regex is exactly the one which is in the help file #include <Date.au3> $iwebdate = "24/12/2023 00:00:15" ; convert $c = StringRegExpReplace($iwebdate, '(\d+)/(\d+)/(\d+)(.*)', "$3/$2/$1$4") ; MsgBox(0, "", $c) $sNewDate = _DateAdd('s', Random(2, 8, 1), $c) ; MsgBox(0, "", $sNewDate) ; convert back $c = StringRegExpReplace($sNewDate, '(\d+)/(\d+)/(\d+)(.*)', "$3/$2/$1$4") MsgBox(0, "", $c)
  9. Regex too but simpler way, works regardless of the newline #include <Array.au3> $file = @ScriptDir & '\The.Girl-UTF.srt' $a = StringRegExp(FileRead($file), '(?s)(\N.+?(?=\R{2}|$))', 3) _ArrayDisplay($a) $sFile = @ScriptDir & '\The.Girl2-ANSI.srt' $a = StringRegExp(FileRead($sFile),'(?s)(\N.+?(?=\R{2}|$))', 3) _ArrayDisplay($a)
  10. $txt = "Connection mode : Profile" & @crlf & _ " Channel : 4" & @crlf & _ " Receive rate (Mbps) : 300" & @crlf & _ " Transmit rate (Mbps) : 65" & @crlf & _ " Signal : 83%" & @crlf & _ " Profile : AndroidAP_4013" & @crlf & _ @crlf & _ " Hosted network status : Not available" Msgbox(0,"", StringRegExp($txt, 'Profile\h*:\h?(.*)', 1)[0] ) Use \h? to avoid matching a space between the colon and the A
  11. Maybe this... $sd = ObjCreate("Scripting.Dictionary") $sd.add("1104", "nbs1") $sd.add("1105", "nbs2") $sd.add("1106", "nbs3") $sd.add("1107", "nbs4") $str = '<trans-unit translate="no" id="bf7c95b8-58a9-4352-988c-7679b8942d49"><source><x id="1103"/><x id="1104"/>' & _ '</source></trans-unit><trans-unit id="47e1477a-98e9-4759-997f-a4e722e63ce5"><source>The quick brown fox<x id="1105"/>' & _ 'ABCDE</source><seg-source><mrk mtype="seg" mid="180">Jumps over the lazy dog<x id="1106"/>FGHIJ</mrk></seg-source>' & _ '<target><mrk mtype="seg" mid="180"/></target><sdl:seg-defs><sdl:seg id="180"/></sdl:seg-defs></trans-unit>' & _ '<trans-unit translate="no" id="aa1f3715-586f-437b-8d7b-d2324b27fc8d"><source><x id="1107"/><x id="1108"/></source></trans-unit>' $r = Execute("'" & StringRegExpReplace($str, "(<x id=""(\d{4})"")/>", _ "' & ($sd.exists('$2') ? '$1 ctype=""' & $sd.item('$2') & '""/>' & $sd.remove('$2') : '$1/>') & '") & "'") Msgbox(0,"", $r) Each replacement will be done only once
  12. or this ;$string = "bob smith cima, phd, ma" $string = "brian o'connor cima, phd, ma" $res = StringRegExpReplace($string, '^([[:alpha:]'']+) ((?1)).*', "$2, $1") MsgBox(0,'', $res)
×
×
  • Create New...