#include <StringConstants.au3> ; to declare the Constants of StringRegExp
#include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate
Local $sRegex = "(?m)^((\s+|)(\/\/|#)|$)"
Local $sString = "##################################################################" & @CRLF & _
"#### /etc/apt/apt.conf.d/50unattended-upgrades ###" & @CRLF & _
"// Automatically upgrade packages from these (origin:archive) pairs" & @CRLF & _
"//" & @CRLF & _
"// Note that in Ubuntu security updates may pull in new dependencies" & @CRLF & _
"// from non-security sources (e.g. chromium). By allowing the release" & @CRLF & _
"// pocket these get automatically pulled in." & @CRLF & _
"Unattended-Upgrade::Allowed-Origins {" & @CRLF & _
" "${distro_id}:${distro_codename}";" & @CRLF & _
" "${distro_id}:${distro_codename}-security";" & @CRLF & _
" // Extended Security Maintenance; doesn't necessarily exist for" & @CRLF & _
" // every release and this system may not have it installed, but if" & @CRLF & _
" // available, the policy for updates is such that unattended-upgrades" & @CRLF & _
" // should also install from here by default." & @CRLF & _
" "${distro_id}ESMApps:${distro_codename}-apps-security";" & @CRLF & _
" "${distro_id}ESM:${distro_codename}-infra-security";" & @CRLF & _
"// "${distro_id}:${distro_codename}-updates";" & @CRLF & _
"// "${distro_id}:${distro_codename}-proposed";" & @CRLF & _
"// "${distro_id}:${distro_codename}-backports";" & @CRLF & _
"};" & @CRLF & _
"" & @CRLF & _
"// Python regular expressions, matching packages to exclude from upgrading" & @CRLF & _
"Unattended-Upgrade::Package-Blacklist {" & @CRLF & _
" // The following matches all packages starting with linux-" & @CRLF & _
"// "linux-";" & @CRLF & _
"" & @CRLF & _
" // Use $ to explicitely define the end of a package name. Without" & @CRLF & _
" // the $, "libc6" would match all of them." & @CRLF & _
"// "libc6$";" & @CRLF & _
"// "libc6-dev$";" & @CRLF & _
"// "libc6-i686$";" & @CRLF & _
"" & @CRLF & _
" // Special characters need escaping" & @CRLF & _
"// "libstdc\+\+6$";" & @CRLF & _
"" & @CRLF & _
" // The following matches packages like xen-system-amd64, xen-utils-4.1," & @CRLF & _
" // xenstore-utils and libxenstore3.0" & @CRLF & _
"// "(lib)?xen(store)?";" & @CRLF & _
"" & @CRLF & _
" // For more information about Python regular expressions, see" & @CRLF & _
" // https://docs.python.org/3/howto/regex.html" & @CRLF & _
"};" & @CRLF & _
"" & @CRLF & _
"// This option controls whether the development release of Ubuntu will be" & @CRLF & _
"// upgraded automatically. Valid values are "true", "false", and "auto"." & @CRLF & _
"Unattended-Upgrade::DevRelease "auto";" & @CRLF & _
"" & @CRLF & _
"" & @CRLF & _
"##################################################################" & @CRLF & _
"#### /etc/cron.weekly/man-db ###" & @CRLF & _
"" & @CRLF & _
"#!/bin/sh" & @CRLF & _
"#" & @CRLF & _
"# man-db cron weekly" & @CRLF & _
"" & @CRLF & _
"set -e" & @CRLF & _
"" & @CRLF & _
"if [ -d /run/systemd/system ]; then" & @CRLF & _
" # Skip in favour of systemd timer." & @CRLF & _
" exit 0" & @CRLF & _
"fi" & @CRLF & _
"" & @CRLF & _
"iosched_idle=" & @CRLF & _
"# Don't try to change I/O priority in a vserver or OpenVZ." & @CRLF & _
"if ! egrep -q '(envID|VxID):.*[1-9]' /proc/self/status && \" & @CRLF & _
" ([ ! -d /proc/vz ] || [ -d /proc/bc ]); then" & @CRLF & _
" iosched_idle='--iosched idle'" & @CRLF & _
"fi" & @CRLF & _
"" & @CRLF & _
"if ! [ -d /var/cache/man ]; then" & @CRLF & _
" # Recover from deletion, per FHS." & @CRLF & _
" install -d -o man -g man -m 0755 /var/cache/man" & @CRLF & _
"fi" & @CRLF & _
"" & @CRLF & _
"# regenerate man database" & @CRLF & _
"if [ -x /usr/bin/mandb ]; then" & @CRLF & _
" # --pidfile /dev/null so it always starts; mandb isn't really a daemon," & @CRLF & _
" # but we want to start it like one." & @CRLF & _
" start-stop-daemon --start --pidfile /dev/null \" & @CRLF & _
" --startas /usr/bin/mandb --oknodo --chuid man \" & @CRLF & _
" $iosched_idle \" & @CRLF & _
" -- --quiet" & @CRLF & _
"fi" & @CRLF & _
"" & @CRLF & _
"exit 0"
Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH)
Local $aFullArray[0]
For $i = 0 To UBound($aArray) -1
_ArrayConcatenate($aFullArray, $aArray[$i])
Next
$aArray = $aFullArray
; Present the entire match result
_ArrayDisplay($aArray, "Result")
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm