找回密码
 加入
搜索
查看: 3093|回复: 14

[网络通信] 求个正则提取某一段中的日期【已解决】感谢 floor6ggg

[复制链接]
发表于 2020-1-25 22:03:44 | 显示全部楼层 |阅读模式
本帖最后由 fybhwsx 于 2020-1-25 23:10 编辑

提取<!-- \Microsoft\Windows\Flighting\OneSettings\RefreshCache -->这一段下面<StartBoundary>后面的2020-01-26
还有<!-- \Microsoft\Windows\PushToInstall\Registration -->这段下面<StartBoundary>后面的2020-01-25



<!-- \Microsoft\Windows\Flighting\OneSettings\RefreshCache -->
<?xml version="1.0" encoding="UTF-16"?>

<Task version="1.6" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">

  <RegistrationInfo>

    <SecurityDescriptor>D:P(A;;FA;;;SY)(A;;FA;;;BA)(A;;FRFX;;;AU)</SecurityDescriptor>

    <Source>$(@%systemroot%\system32\wosc.dll,-602)</Source>

    <Author>$(@%systemroot%\system32\wosc.dll,-601)</Author>

    <Description>$(@%systemroot%\system32\wosc.dll,-603)</Description>

    <URI>\Microsoft\Windows\Flighting\OneSettings\RefreshCache</URI>

  </RegistrationInfo>

  <Principals>

    <Principal id="LocalSystem">

      <UserId>S-1-5-18</UserId>

    </Principal>

  </Principals>

  <Settings>

    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>

    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>

    <ExecutionTimeLimit>PT5M</ExecutionTimeLimit>

    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>

    <RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>

    <IdleSettings>

      <StopOnIdleEnd>false</StopOnIdleEnd>

      <RestartOnIdle>false</RestartOnIdle>

    </IdleSettings>

    <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>

  </Settings>

  <Triggers>

    <TimeTrigger>

      <StartBoundary>2020-01-26T21:10:22+08:00</StartBoundary>

      <Repetition>

        <Interval>PT3H23M</Interval>

      </Repetition>

      <RandomDelay>PT1H</RandomDelay>

    </TimeTrigger>

    <WnfStateChangeTrigger>

      <StateName>7538BCA33A019502</StateName>

    </WnfStateChangeTrigger>

  </Triggers>

  <Actions Context="LocalSystem">

    <ComHandler>

      <ClassId>{E07647F7-AED2-48D9-9720-939BC24A8A3C}</ClassId>

    </ComHandler>

  </Actions>

</Task>



<!-- \Microsoft\Windows\HelloFace\FODCleanupTask -->
<?xml version="1.0" encoding="UTF-16"?>

<Task version="1.6" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">

  <RegistrationInfo>

    <SecurityDescriptor>D:P(A;;FA;;;BA)(A;;FA;;;SY)(A;;FA;;;NU)</SecurityDescriptor>

    <URI>\Microsoft\Windows\HelloFace\FODCleanupTask</URI>

  </RegistrationInfo>

  <Principals>

    <Principal id="System">

      <UserId>S-1-5-18</UserId>

      <RunLevel>HighestAvailable</RunLevel>

    </Principal>

  </Principals>

  <Settings>

    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>

    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>

    <ExecutionTimeLimit>PT15M</ExecutionTimeLimit>

    <Hidden>true</Hidden>

    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>

    <Priority>8</Priority>

    <StartWhenAvailable>true</StartWhenAvailable>

    <RunOnlyIfIdle>true</RunOnlyIfIdle>

    <IdleSettings>

      <Duration>PT5M</Duration>

      <WaitTimeout>PT2H</WaitTimeout>

      <StopOnIdleEnd>false</StopOnIdleEnd>

      <RestartOnIdle>false</RestartOnIdle>

    </IdleSettings>

    <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>

    <MaintenanceSettings>

      <Period>P7D</Period>

      <Deadline>P30D</Deadline>

    </MaintenanceSettings>

  </Settings>

  <Triggers>

    <RegistrationTrigger />

  </Triggers>

  <Actions Context="System">

    <Exec>

      <Command>%WinDir%\System32\WinBioPlugIns\FaceFodUninstaller.exe</Command>

    </Exec>

  </Actions>

</Task>



<!-- \Microsoft\Windows\PushToInstall\Registration -->
<?xml version="1.0" encoding="UTF-16"?>

<Task version="1.6" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">

  <RegistrationInfo>

    <Version>1.0</Version>

    <SecurityDescriptor>D:P(A;;FA;;;SY)(A;;FA;;;BA)(A;;GRGX;;;SU)</SecurityDescriptor>

    <URI>\Microsoft\Windows\PushToInstall\Registration</URI>

  </RegistrationInfo>

  <Principals>

    <Principal id="LocalSystem">

      <UserId>S-1-5-18</UserId>

      <RunLevel>HighestAvailable</RunLevel>

    </Principal>

  </Principals>

  <Settings>

    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>

    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>

    <ExecutionTimeLimit>PT1H</ExecutionTimeLimit>

    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>

    <StartWhenAvailable>true</StartWhenAvailable>

    <RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>

    <IdleSettings>

      <StopOnIdleEnd>true</StopOnIdleEnd>

      <RestartOnIdle>false</RestartOnIdle>

    </IdleSettings>

    <DisallowStartOnRemoteAppSession>true</DisallowStartOnRemoteAppSession>

    <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>

  </Settings>

  <Triggers>

    <TimeTrigger>

      <StartBoundary>2020-01-25T07:03:40</StartBoundary>

      <Repetition>

        <Interval>P20D</Interval>

      </Repetition>

    </TimeTrigger>

    <WnfStateChangeTrigger>

      <Delay>PT15M</Delay>

      <StateName>750CBCA3290B9641</StateName>

      <Data>01</Data>

    </WnfStateChangeTrigger>

  </Triggers>

  <Actions Context="LocalSystem">

    <Exec>

      <Command>%windir%\system32\sc.exe</Command>

      <Arguments>start pushtoinstall registration</Arguments>

    </Exec>

  </Actions>

</Task>

<!-- \Microsoft\Windows\InstallService\ScanForUpdates -->
<?xml version="1.0" encoding="UTF-16"?>

<Task version="1.6" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">

  <RegistrationInfo>

    <SecurityDescriptor>D:(A;;FA;;;SY)(A;;FRFX;;;BA)</SecurityDescriptor>

    <URI>\Microsoft\Windows\InstallService\ScanForUpdates</URI>

  </RegistrationInfo>

  <Principals>

    <Principal id="LocalSystem">

      <UserId>S-1-5-18</UserId>

    </Principal>

  </Principals>

  <Settings>

    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>

    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>

    <ExecutionTimeLimit>PT4H</ExecutionTimeLimit>

    <MultipleInstancesPolicy>Queue</MultipleInstancesPolicy>

    <StartWhenAvailable>true</StartWhenAvailable>

    <RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>

    <IdleSettings>

      <StopOnIdleEnd>true</StopOnIdleEnd>

      <RestartOnIdle>false</RestartOnIdle>

    </IdleSettings>

    <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>

  </Settings>

  <Triggers>

    <TimeTrigger>

      <StartBoundary>2014-01-01T08:00:00+08:00</StartBoundary>

      <Repetition>

        <Interval>P1D</Interval>

      </Repetition>

      <RandomDelay>P1D</RandomDelay>

    </TimeTrigger>

    <WnfStateChangeTrigger id="7524BCA33E06830D">

      <Delay>PT15M</Delay>

      <StateName>7524BCA33E06830D</StateName>

    </WnfStateChangeTrigger>

    <TimeTrigger id="ServerRecommendedScheduledRetry">

      <StartBoundary>2014-01-01T08:00:00+08:00</StartBoundary>

      <Enabled>false</Enabled>

    </TimeTrigger>

  </Triggers>

  <Actions Context="LocalSystem">

    <ComHandler>

      <ClassId>{A558C6A5-B42B-4C98-B610-BF9559143139}</ClassId>

    </ComHandler>

  </Actions>

</Task>





发表于 2020-1-25 22:27:54 | 显示全部楼层
我的解法:

直接用 : <StartBoundary>(.*)T
匹配出来的结果:
[0]2020-01-26
[1]2020-01-25
[2]2014-01-01
[3]2014-01-01
[完毕]


进一步限定一下日期以剔除2014的2个数据:
用:<StartBoundary>(202.*?)T
匹配出来的结果:
[0]2020-01-26
[1]2020-01-25
[完毕]

 楼主| 发表于 2020-1-25 22:31:35 | 显示全部楼层
floor6ggg 发表于 2020-1-25 22:27
我的解法:

直接用 : (.*)T

感谢!不过这只是我截取的一部分代码,完整代码还很长,很多这样的日期。
如果分步,也应该先整段提取,然后再提取日期。
发表于 2020-1-25 22:33:21 | 显示全部楼层
本帖最后由 floor6ggg 于 2020-1-25 22:53 编辑

第一个:
(?s)<!-- \\Microsoft\\Windows\\Flighting\\OneSettings\\RefreshCache -->.*?<StartBoundary>(.*?)T
结果:
[0]2020-01-26
[完毕]

发表于 2020-1-25 22:45:14 | 显示全部楼层
第二个:
(?s)<!-- \\Microsoft\\Windows\\PushToInstall\\Registration -->.*?<StartBoundary>(.*?)T
结果:
[0]2020-01-25
[完毕]

发表于 2020-1-25 22:48:33 | 显示全部楼层
本帖最后由 floor6ggg 于 2020-1-25 22:50 编辑
fybhwsx 发表于 2020-1-25 22:31
感谢!不过这只是我截取的一部分代码,完整代码还很长,很多这样的日期。
如果分步,也应该先整段提取, ...

合并的写法:
(?s)<!-- \\Microsoft\\Windows\\.*?<StartBoundary>(.*?)T
测试结果:
[0]2020-01-26
[1]2020-01-25
[2]2014-01-01
[完毕]


要去除2014的数据,括号里面稍加点特征,自行修改啦…………
(?s)<!-- \\Microsoft\\Windows\\.*?<StartBoundary>(202.*?)T

发表于 2020-1-25 23:04:08 | 显示全部楼层
另外一种解法:限定仅该2类段落下面的内容:
(?s)<!-- \\Microsoft\\Windows\\(Flighting\\OneSettings\\RefreshCache|PushToInstall\\Registration).*?<StartBoundary>(202.*?)T
结果:

[0]Flighting\OneSettings\RefreshCache
[1]2020-01-26
[2]PushToInstall\Registration
[3]2020-01-25
[完毕]


水平不够,暂时不清楚有没有去处掉返回的[0]和[2],如果有,请告知,谢谢!!

返回的数组需要后续再加工一下,重新构建自己需要的数组,或者直接采取 step 2 的方式来取值…………

 楼主| 发表于 2020-1-25 23:04:39 | 显示全部楼层
floor6ggg 发表于 2020-1-25 22:48
合并的写法:

测试结果:

日期不能加条件的。我还是按你第一个第二个分两步提取吧,谢谢!!
发表于 2020-1-25 23:14:03 | 显示全部楼层
fybhwsx 发表于 2020-1-25 23:04
日期不能加条件的。我还是按你第一个第二个分两步提取吧,谢谢!!

翻查了一下A大的正则表达神器的说明,你在试一下下面的:
(?s)<!-- \\Microsoft\\Windows\\(?:Flighting\\OneSettings\\RefreshCache|PushToInstall\\Registration).*?<StartBoundary>(.*?)T

发表于 2020-1-25 23:17:31 | 显示全部楼层
本帖最后由 floor6ggg 于 2020-1-25 23:19 编辑

说明是:
(?:abc)(?#匹配abc但不成组)

方框里面限定了段落的特征,前面加了: ?:   ,居然成功了………… A大的神器!!!!没得说!!!厉害!!!
具体原理不清楚,但测试的结果还行…………
结果:
[0]2020-01-26
[1]2020-01-25
[完毕]
 楼主| 发表于 2020-1-25 23:20:14 | 显示全部楼层
floor6ggg 发表于 2020-1-25 23:14
翻查了一下A大的正则表达神器的说明,你在试一下下面的:

太好了,一步解决,谢谢!!
发表于 2020-2-1 12:28:35 | 显示全部楼层
### 友情提示:本脚本由 Au3.REHelper 于 2020/02/01 12:28 自动生成,不保证其正确性,请自行测试 ###
#include <Array.au3>
Local $sSource = _
                '<!-- \Microsoft\Windows\Flighting\OneSettings\RefreshCache -->' & @CRLF & _
                '<?xml version="1.0" encoding="UTF-16"?>' & @CRLF & @CRLF & _
                '<Task version="1.6" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">' & @CRLF & @CRLF & _
                '  <RegistrationInfo>' & @CRLF & @CRLF & _
                '    <SecurityDescriptor>D:P(A;;FA;;;SY)(A;;FA;;;BA)(A;;FRFX;;;AU)</SecurityDescriptor>' & @CRLF & @CRLF & _
                '    <Source>$(@%systemroot%\system32\wosc.dll,-602)</Source>' & @CRLF & @CRLF & _
                '    <Author>$(@%systemroot%\system32\wosc.dll,-601)</Author>' & @CRLF & @CRLF & _
                '    <Description>$(@%systemroot%\system32\wosc.dll,-603)</Description>' & @CRLF & @CRLF & _
                '    <URI>\Microsoft\Windows\Flighting\OneSettings\RefreshCache</URI>' & @CRLF & @CRLF & _
                '  </RegistrationInfo>' & @CRLF & @CRLF & _
                '  <Principals>' & @CRLF & @CRLF & _
                '    <Principal id="LocalSystem">' & @CRLF & @CRLF & _
                '      <UserId>S-1-5-18</UserId>' & @CRLF & @CRLF & _
                '    </Principal>' & @CRLF & @CRLF & _
                '  </Principals>' & @CRLF & @CRLF & _
                '  <Settings>' & @CRLF & @CRLF & _
                '    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>' & @CRLF & @CRLF & _
                '    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>' & @CRLF & @CRLF & _
                '    <ExecutionTimeLimit>PT5M</ExecutionTimeLimit>' & @CRLF & @CRLF & _
                '    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>' & @CRLF & @CRLF & _
                '    <RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>' & @CRLF & @CRLF & _
                '    <IdleSettings>' & @CRLF & @CRLF & _
                '      <StopOnIdleEnd>false</StopOnIdleEnd>' & @CRLF & @CRLF & _
                '      <RestartOnIdle>false</RestartOnIdle>' & @CRLF & @CRLF & _
                '    </IdleSettings>' & @CRLF & @CRLF & _
                '    <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>' & @CRLF & @CRLF & _
                '  </Settings>' & @CRLF & @CRLF & _
                '  <Triggers>' & @CRLF & @CRLF & _
                '    <TimeTrigger>' & @CRLF & @CRLF & _
                '      <StartBoundary>2020-01-26T21:10:22+08:00</StartBoundary>' & @CRLF & @CRLF & _
                '      <Repetition>' & @CRLF & @CRLF & _
                '        <Interval>PT3H23M</Interval>' & @CRLF & @CRLF & _
                '      </Repetition>' & @CRLF & @CRLF & _
                '      <RandomDelay>PT1H</RandomDelay>' & @CRLF & @CRLF & _
                '    </TimeTrigger>' & @CRLF & @CRLF & _
                '    <WnfStateChangeTrigger>' & @CRLF & @CRLF & _
                '      <StateName>7538BCA33A019502</StateName>' & @CRLF & @CRLF & _
                '    </WnfStateChangeTrigger>' & @CRLF & @CRLF & _
                '  </Triggers>' & @CRLF & @CRLF & _
                '  <Actions Context="LocalSystem">' & @CRLF & @CRLF & _
                '    <ComHandler>' & @CRLF & @CRLF & _
                '      <ClassId>{E07647F7-AED2-48D9-9720-939BC24A8A3C}</ClassId>' & @CRLF & @CRLF & _
                '    </ComHandler>' & @CRLF & @CRLF & _
                '  </Actions>' & @CRLF & @CRLF & _
                '</Task>' & @CRLF & @CRLF & @CRLF & @CRLF & _
                '<!-- \Microsoft\Windows\HelloFace\FODCleanupTask -->' & @CRLF & _
                '<?xml version="1.0" encoding="UTF-16"?>' & @CRLF & @CRLF & _
                '<Task version="1.6" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">' & @CRLF & @CRLF & _
                '  <RegistrationInfo>' & @CRLF & @CRLF & _
                '    <SecurityDescriptor>D:P(A;;FA;;;BA)(A;;FA;;;SY)(A;;FA;;;NU)</SecurityDescriptor>' & @CRLF & @CRLF & _
                '    <URI>\Microsoft\Windows\HelloFace\FODCleanupTask</URI>' & @CRLF & @CRLF & _
                '  </RegistrationInfo>' & @CRLF & @CRLF & _
                '  <Principals>' & @CRLF & @CRLF & _
                '    <Principal id="System">' & @CRLF & @CRLF & _
                '      <UserId>S-1-5-18</UserId>' & @CRLF & @CRLF & _
                '      <RunLevel>HighestAvailable</RunLevel>' & @CRLF & @CRLF & _
                '    </Principal>' & @CRLF & @CRLF & _
                '  </Principals>' & @CRLF & @CRLF & _
                '  <Settings>' & @CRLF & @CRLF & _
                '    <DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>' & @CRLF & @CRLF & _
                '    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>' & @CRLF & @CRLF & _
                '    <ExecutionTimeLimit>PT15M</ExecutionTimeLimit>' & @CRLF & @CRLF & _
                '    <Hidden>true</Hidden>' & @CRLF & @CRLF & _
                '    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>' & @CRLF & @CRLF & _
                '    <Priority>8</Priority>' & @CRLF & @CRLF & _
                '    <StartWhenAvailable>true</StartWhenAvailable>' & @CRLF & @CRLF & _
                '    <RunOnlyIfIdle>true</RunOnlyIfIdle>' & @CRLF & @CRLF & _
                '    <IdleSettings>' & @CRLF & @CRLF & _
                '      <Duration>PT5M</Duration>' & @CRLF & @CRLF & _
                '      <WaitTimeout>PT2H</WaitTimeout>' & @CRLF & @CRLF & _
                '      <StopOnIdleEnd>false</StopOnIdleEnd>' & @CRLF & @CRLF & _
                '      <RestartOnIdle>false</RestartOnIdle>' & @CRLF & @CRLF & _
                '    </IdleSettings>' & @CRLF & @CRLF & _
                '    <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>' & @CRLF & @CRLF & _
                '    <MaintenanceSettings>' & @CRLF & @CRLF & _
                '      <Period>P7D</Period>' & @CRLF & @CRLF & _
                '      <Deadline>P30D</Deadline>' & @CRLF & @CRLF & _
                '    </MaintenanceSettings>' & @CRLF & @CRLF & _
                '  </Settings>' & @CRLF & @CRLF & _
                '  <Triggers>' & @CRLF & @CRLF & _
                '    <RegistrationTrigger />' & @CRLF & @CRLF & _
                '  </Triggers>' & @CRLF & @CRLF & _
                '  <Actions Context="System">' & @CRLF & @CRLF & _
                '    <Exec>' & @CRLF & @CRLF & _
                '      <Command>%WinDir%\System32\WinBioPlugIns\FaceFodUninstaller.exe</Command>' & @CRLF & @CRLF & _
                '    </Exec>' & @CRLF & @CRLF & _
                '  </Actions>' & @CRLF & @CRLF & _
                '</Task>' & @CRLF & @CRLF & @CRLF & @CRLF & _
                '<!-- \Microsoft\Windows\PushToInstall\Registration -->' & @CRLF & _
                '<?xml version="1.0" encoding="UTF-16"?>' & @CRLF & @CRLF & _
                '<Task version="1.6" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">' & @CRLF & @CRLF & _
                '  <RegistrationInfo>' & @CRLF & @CRLF & _
                '    <Version>1.0</Version>' & @CRLF & @CRLF & _
                '    <SecurityDescriptor>D:P(A;;FA;;;SY)(A;;FA;;;BA)(A;;GRGX;;;SU)</SecurityDescriptor>' & @CRLF & @CRLF & _
                '    <URI>\Microsoft\Windows\PushToInstall\Registration</URI>' & @CRLF & @CRLF & _
                '  </RegistrationInfo>' & @CRLF & @CRLF & _
                '  <Principals>' & @CRLF & @CRLF & _
                '    <Principal id="LocalSystem">' & @CRLF & @CRLF & _
                '      <UserId>S-1-5-18</UserId>' & @CRLF & @CRLF & _
                '      <RunLevel>HighestAvailable</RunLevel>' & @CRLF & @CRLF & _
                '    </Principal>' & @CRLF & @CRLF & _
                '  </Principals>' & @CRLF & @CRLF & _
                '  <Settings>' & @CRLF & @CRLF & _
                '    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>' & @CRLF & @CRLF & _
                '    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>' & @CRLF & @CRLF & _
                '    <ExecutionTimeLimit>PT1H</ExecutionTimeLimit>' & @CRLF & @CRLF & _
                '    <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>' & @CRLF & @CRLF & _
                '    <StartWhenAvailable>true</StartWhenAvailable>' & @CRLF & @CRLF & _
                '    <RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>' & @CRLF & @CRLF & _
                '    <IdleSettings>' & @CRLF & @CRLF & _
                '      <StopOnIdleEnd>true</StopOnIdleEnd>' & @CRLF & @CRLF & _
                '      <RestartOnIdle>false</RestartOnIdle>' & @CRLF & @CRLF & _
                '    </IdleSettings>' & @CRLF & @CRLF & _
                '    <DisallowStartOnRemoteAppSession>true</DisallowStartOnRemoteAppSession>' & @CRLF & @CRLF & _
                '    <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>' & @CRLF & @CRLF & _
                '  </Settings>' & @CRLF & @CRLF & _
                '  <Triggers>' & @CRLF & @CRLF & _
                '    <TimeTrigger>' & @CRLF & @CRLF & _
                '      <StartBoundary>2020-01-25T07:03:40</StartBoundary>' & @CRLF & @CRLF & _
                '      <Repetition>' & @CRLF & @CRLF & _
                '        <Interval>P20D</Interval>' & @CRLF & @CRLF & _
                '      </Repetition>' & @CRLF & @CRLF & _
                '    </TimeTrigger>' & @CRLF & @CRLF & _
                '    <WnfStateChangeTrigger>' & @CRLF & @CRLF & _
                '      <Delay>PT15M</Delay>' & @CRLF & @CRLF & _
                '      <StateName>750CBCA3290B9641</StateName>' & @CRLF & @CRLF & _
                '      <Data>01</Data>' & @CRLF & @CRLF & _
                '    </WnfStateChangeTrigger>' & @CRLF & @CRLF & _
                '  </Triggers>' & @CRLF & @CRLF & _
                '  <Actions Context="LocalSystem">' & @CRLF & @CRLF & _
                '    <Exec>' & @CRLF & @CRLF & _
                '      <Command>%windir%\system32\sc.exe</Command>' & @CRLF & @CRLF & _
                '      <Arguments>start pushtoinstall registration</Arguments>' & @CRLF & @CRLF & _
                '    </Exec>' & @CRLF & @CRLF & _
                '  </Actions>' & @CRLF & @CRLF & _
                '</Task>' & @CRLF & @CRLF & _
                '<!-- \Microsoft\Windows\InstallService\ScanForUpdates -->' & @CRLF & _
                '<?xml version="1.0" encoding="UTF-16"?>' & @CRLF & @CRLF & _
                '<Task version="1.6" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">' & @CRLF & @CRLF & _
                '  <RegistrationInfo>' & @CRLF & @CRLF & _
                '    <SecurityDescriptor>D:(A;;FA;;;SY)(A;;FRFX;;;BA)</SecurityDescriptor>' & @CRLF & @CRLF & _
                '    <URI>\Microsoft\Windows\InstallService\ScanForUpdates</URI>' & @CRLF & @CRLF & _
                '  </RegistrationInfo>' & @CRLF & @CRLF & _
                '  <Principals>' & @CRLF & @CRLF & _
                '    <Principal id="LocalSystem">' & @CRLF & @CRLF & _
                '      <UserId>S-1-5-18</UserId>' & @CRLF & @CRLF & _
                '    </Principal>' & @CRLF & @CRLF & _
                '  </Principals>' & @CRLF & @CRLF & _
                '  <Settings>' & @CRLF & @CRLF & _
                '    <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>' & @CRLF & @CRLF & _
                '    <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>' & @CRLF & @CRLF & _
                '    <ExecutionTimeLimit>PT4H</ExecutionTimeLimit>' & @CRLF & @CRLF & _
                '    <MultipleInstancesPolicy>Queue</MultipleInstancesPolicy>' & @CRLF & @CRLF & _
                '    <StartWhenAvailable>true</StartWhenAvailable>' & @CRLF & @CRLF & _
                '    <RunOnlyIfNetworkAvailable>true</RunOnlyIfNetworkAvailable>' & @CRLF & @CRLF & _
                '    <IdleSettings>' & @CRLF & @CRLF & _
                '      <StopOnIdleEnd>true</StopOnIdleEnd>' & @CRLF & @CRLF & _
                '      <RestartOnIdle>false</RestartOnIdle>' & @CRLF & @CRLF & _
                '    </IdleSettings>' & @CRLF & @CRLF & _
                '    <UseUnifiedSchedulingEngine>true</UseUnifiedSchedulingEngine>' & @CRLF & @CRLF & _
                '  </Settings>' & @CRLF & @CRLF & _
                '  <Triggers>' & @CRLF & @CRLF & _
                '    <TimeTrigger>' & @CRLF & @CRLF & _
                '      <StartBoundary>2014-01-01T08:00:00+08:00</StartBoundary>' & @CRLF & @CRLF & _
                '      <Repetition>' & @CRLF & @CRLF & _
                '        <Interval>P1D</Interval>' & @CRLF & @CRLF & _
                '      </Repetition>' & @CRLF & @CRLF & _
                '      <RandomDelay>P1D</RandomDelay>' & @CRLF & @CRLF & _
                '    </TimeTrigger>' & @CRLF & @CRLF & _
                '    <WnfStateChangeTrigger id="7524BCA33E06830D">' & @CRLF & @CRLF & _
                '      <Delay>PT15M</Delay>' & @CRLF & @CRLF & _
                '      <StateName>7524BCA33E06830D</StateName>' & @CRLF & @CRLF & _
                '    </WnfStateChangeTrigger>' & @CRLF & @CRLF & _
                '    <TimeTrigger id="ServerRecommendedScheduledRetry">' & @CRLF & @CRLF & _
                '      <StartBoundary>2014-01-01T08:00:00+08:00</StartBoundary>' & @CRLF & @CRLF & _
                '      <Enabled>false</Enabled>' & @CRLF & @CRLF & _
                '    </TimeTrigger>' & @CRLF & @CRLF & _
                '  </Triggers>' & @CRLF & @CRLF & _
                '  <Actions Context="LocalSystem">' & @CRLF & @CRLF & _
                '    <ComHandler>' & @CRLF & @CRLF & _
                '      <ClassId>{A558C6A5-B42B-4C98-B610-BF9559143139}</ClassId>' & @CRLF & @CRLF & _
                '    </ComHandler>' & @CRLF & @CRLF & _
                '  </Actions>' & @CRLF & @CRLF & _
                '</Task>'
;~MsgBox(0, '源字符串', $sSource)
Local $aSRE = StringRegExp($sSource, '20\d{2}-\d{2}-\d{2}', 3)
If Not @Error Then MsgBox(0, '匹配数量: ' & UBound($aSRE), '其中[0]元素为: ' & $aSRE[0])
_ArrayDisplay($aSRE, UBound($aSRE))
 楼主| 发表于 2020-2-1 13:43:55 | 显示全部楼层

谢谢,日期不能作为提取条件。floor6ggg 已帮我完美解决了。。
发表于 2020-2-1 13:54:26 | 显示全部楼层
fybhwsx 发表于 2020-2-1 13:43
谢谢,日期不能作为提取条件。floor6ggg 已帮我完美解决了。。

你取的不就是要日期吗?
 楼主| 发表于 2020-2-1 13:56:51 | 显示全部楼层
嗯嗯,还有个条件,指定的两个段落中。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-16 08:37 , Processed in 0.077063 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表