Regular Expressions 101

Save & Share

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression
No Match

r"
"

Test String

Code Generator

Generated Code

#include <StringConstants.au3> ; to declare the Constants of StringRegExp #include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate Local $sRegex = "key[ :']+([^,;'"]+)[ '",;]+" Local $sString = "<!DOCTYPE html>" & @CRLF & _ "<!--[if lt IE 7]><html class="ie6 oldie" lang="zh"><![endif]-->" & @CRLF & _ "<!--[if IE 7]><html class="ie7 oldie" lang="zh"><![endif]-->" & @CRLF & _ "<!--[if IE 8]><html class="ie8 oldie" lang="zh"><![endif]-->" & @CRLF & _ "<!--[if gt IE 8]><!--> <html lang="zh"> <!--<![endif]-->" & @CRLF & _ "<head>" & @CRLF & _ "<meta http-equiv="X-UA-Compatible" content="edge" />" & @CRLF & _ "<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />" & @CRLF & _ "<meta name="renderer" content="webkit">" & @CRLF & _ "<!--[if lt IE 7]>" & @CRLF & _ "<meta http-equiv="refresh" content="0; url=http://miwifi.com/cgi-bin/luci/web/ieblock" />" & @CRLF & _ "<![endif]-->" & @CRLF & _ "<!--[if gte IE 9]>" & @CRLF & _ "<style>" & @CRLF & _ "body {" & @CRLF & _ " filter: none;" & @CRLF & _ "}" & @CRLF & _ "</style>" & @CRLF & _ "<![endif]-->" & @CRLF & _ " <title>小米路由器</title>" & @CRLF & _ " <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">" & @CRLF & _ " <link href="/xiaoqiang/web/css/bc.css?v=0.0.3" rel="stylesheet">" & @CRLF & _ " <link href="/xiaoqiang/web/css/login.css?v=0.0.3" rel="stylesheet">" & @CRLF & _ "</head>" & @CRLF & _ "<body>" & @CRLF & _ "<div id="doc">" & @CRLF & _ " <div id="hd">" & @CRLF & _ " </div>" & @CRLF & _ " <div id="bd">" & @CRLF & _ " <div class="mod-login">" & @CRLF & _ " <div class="title">" & @CRLF & _ " <img src="/xiaoqiang/web/img/zh_cn/bg_login_tit.png?v=0.0.3" height="124">" & @CRLF & _ " </div>" & @CRLF & _ " <div class="pic">" & @CRLF & _ " <img src="/xiaoqiang/web/img/topograph/router_r3_101.png" >" & @CRLF & _ " </div>" & @CRLF & _ " <div class="rtname">" & @CRLF & _ " Xiaomi_6FAC (家)" & @CRLF & _ " </div>" & @CRLF & _ " <form id="rtloginform" name="rtloginform" method="post" class="form-login">" & @CRLF & _ " <div class="form-item">" & @CRLF & _ " <span class="v"><input id="password" class="ipt-text" type="password" name="router_password" autocomplete="off" placeholder="请输入路由器管理密码" reqMsg="请输入路由器管理密码"></span>" & @CRLF & _ " <em class="t"></em>" & @CRLF & _ " </div>" & @CRLF & _ " <div class="form-contral">" & @CRLF & _ " <a id="btnRtSubmit" class="btn-login"></a>" & @CRLF & _ " </div>" & @CRLF & _ " </form>" & @CRLF & _ " <div class="mobile-ft">" & @CRLF & _ " <p>" & @CRLF & _ " <a target="_blank" href="http://www1.miwifi.com">官方网站</a>" & @CRLF & _ " </p>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ " </div>" & @CRLF & _ " " & @CRLF & _ "<div id="ft">" & @CRLF & _ " <p>&copy; 2015 小米路由器<span>|</span><a href="http://www1.miwifi.com" target="_blank">官方网站</a><span>|</span><a href="http://weibo.com/xiaomiluyouqi" target="_blank">官方微博</a><span>|</span><a href="https://land.xiaomi.net/res/e1fdbc3/land/miwifi/wf_2dcode.jpg" target="_blank" id="wechatcode">官方微信</a><span>|</span><a href="http://bbs.xiaomi.cn/f-354" target="_blank">用户社区</a><span>|</span><a target="_blank" href="http://www1.miwifi.com/miwifi_faq.html">常见问题</a><span>|</span>服务热线 400-100-5678<p>" & @CRLF & _ "</div>" & @CRLF & _ "" & @CRLF & _ "</div>" & @CRLF & _ "" & @CRLF & _ "<!--[if lt IE 7]>" & @CRLF & _ "<script>" & @CRLF & _ "try{ document.execCommand("BackgroundImageCache",false,true);} catch(e){}" & @CRLF & _ "</script>" & @CRLF & _ "<![endif]-->" & @CRLF & _ "<div class="mask-menu" id="maskMenu" style="position:fixed;left:0;top:0; width:100%; height:100%; z-index:2; display:none;"></div>" & @CRLF & _ "<div id="dropmenu" class="dropmenu" style="z-index:3; display:none;">" & @CRLF & _ " <ul>" & @CRLF & _ " <li><a href="#" id="toRename">修改路由器名称</a></li>" & @CRLF & _ " " & @CRLF & _ " <li><a href="/cgi-bin/luci/web/setting/upgrade">系统升级</a></li>" & @CRLF & _ " " & @CRLF & _ " <li><a href="#" id="toDownloadClient">下载客户端</a></li>" & @CRLF & _ " <li><a href="#" id="toReboot">重启</a></li>" & @CRLF & _ " " & @CRLF & _ " <li class="last"><a href="/cgi-bin/luci/web/logout">注销</a></li>" & @CRLF & _ " </ul>" & @CRLF & _ "</div>" & @CRLF & _ "<div id="noticebar" class="noticebar" style="z-index:3; display:none;">" & @CRLF & _ " <i class="ico-arrow"></i>" & @CRLF & _ " <div class="content"></div>" & @CRLF & _ "</div>" & @CRLF & _ "<script>" & @CRLF & _ "var i18n = {};" & @CRLF & _ "i18n.dialog = {" & @CRLF & _ " ok: '确认'," & @CRLF & _ " cancel: '取消'," & @CRLF & _ " loading: '加载中...'," & @CRLF & _ " dlgtitle: '消息框'" & @CRLF & _ "};" & @CRLF & _ "i18n.valid = {" & @CRLF & _ " n_integer: '请输入一个{$0}位正整数。'," & @CRLF & _ " n_format: '数字输入格式为&#34;{$0}&#34;。'," & @CRLF & _ " n_upper: '输入值太大,最大允许{$0}。', //注意:{$0}表示允许值,{$1}表示实际值" & @CRLF & _ " n_lower: '输入值太小,最小允许{$0}。'," & @CRLF & _ " nrange_from: '您输入的范围不合理。'," & @CRLF & _ " nrange_to: '您输入的范围不合理。'," & @CRLF & _ " n_useless_zero: '数字前面好像有多余的&#34;0&#34;。'," & @CRLF & _ " d_format: '日期输入格式为&#34;YYYY-MM-DD&#34;。'," & @CRLF & _ " d_upper: '日期太晚,最晚允许{$0}。'," & @CRLF & _ " d_lower: '日期太早,最早允许{$0}。'," & @CRLF & _ " daterange_from: '起始日期不能大于截止日期。'," & @CRLF & _ " daterange_to: '截止日期不能小于起始日期。'," & @CRLF & _ " daterange_larger_span: "时间跨度不得超过{$0}天。"," & @CRLF & _ " text_longer: '最多允许{$0}个字。', //'{$1}字太多,最多允许{$0}字'" & @CRLF & _ " text_shorter: '请至少输入{$0}个字。', //'{$1}字太少,最少允许{$0}字'" & @CRLF & _ " bytetext_longer: '最多允许{$0}个字节。', //'{$1}字节太多,最多允许{$0}字节'" & @CRLF & _ " bytetext_shorter: '请至少输入{$0}个字节。', //'{$1}字节太少,最少允许{$0}字节'" & @CRLF & _ " richtext_longer: '最多允许{$0}个字。'," & @CRLF & _ " richtext_shorter: '请至少输入{$0}个字。'," & @CRLF & _ " _reconfirm: '两次输入不一致。'," & @CRLF & _ " _time: '请检查您输入的时间格式。'," & @CRLF & _ " _minute: '请检查您输入的时间格式。'," & @CRLF & _ " _email: '请检查您输入的Email格式。'," & @CRLF & _ " _mobilecode: '请检查您输入的手机号码。'," & @CRLF & _ " _phone: '请检查您输入的电话号码。'," & @CRLF & _ " _phonewithext: '请检查您输入的电话号码。'," & @CRLF & _ " _phonezone: '请检查您输入的电话区号。'," & @CRLF & _ " _phonecode: '请检查您输入的电话号码。'," & @CRLF & _ " _phoneext: '请检查您输入的电话分机号码。'," & @CRLF & _ " _zipcode: '请检查您输入的邮政编码。'," & @CRLF & _ " _idnumber: '请检查您输入的身份证号码,目前只支持15位或者18位。'," & @CRLF & _ " _bankcard: '请检查您输入的银行账号。'," & @CRLF & _ " _cnname: '请检查您输入的姓名。'," & @CRLF & _ " _vcode: '请检查您输入的验证码。'," & @CRLF & _ " _imgfile: '请检查您选择的图片文件路径,只支持jpg、jpeg、png、gif、tif、bmp格式。'," & @CRLF & _ " _regexp: '请检查您的输入。'," & @CRLF & _ " _magic: '请检查您的输入。'," & @CRLF & _ " _req_text: '请填写{$0}。'," & @CRLF & _ " _req_select: '请选择{$0}。'," & @CRLF & _ " _req_file: '请上传{$0}。'," & @CRLF & _ " _logicrequired: '{$0}输入不完整.'," & @CRLF & _ " _ssid: '请输入标准字符,如 Xiaomi.Luyouqi'," & @CRLF & _ " _macaddr: 'MAC地址格式有误,如ab:cd:ef:11:22:33'," & @CRLF & _ " _weppassword: '密码输入有误'," & @CRLF & _ " _wifipassword: '不能包含中文'," & @CRLF & _ " _ipaddr: 'IP地址由4个 0~255 之间的数字组成,数字之间用点区隔'," & @CRLF & _ " _url: '必须是完整的URL,如 http://miwifi.com'" & @CRLF & _ "};" & @CRLF & _ "</script>" & @CRLF & _ "<script src="/js/jquery-1.8.3.js?v=0.0.3"></script>" & @CRLF & _ "<script src="/js/qwrap.js?v=0.0.3"></script>" & @CRLF & _ "<script src="/js/common.js?v=0.0.3"></script>" & @CRLF & _ "<script src="/js/raphael.js?v=0.0.3"></script>" & @CRLF & _ "<script src="/js/crypto-js/rollups/sha1.js?v=0.0.3"></script>" & @CRLF & _ "<script src="/js/crypto-js/rollups/aes.js?v=0.0.3"></script>" & @CRLF & _ "<script src="/js/valid.js?v=0.0.3"></script>" & @CRLF & _ "<script src="/xiaoqiang/web/js/selectbeautify.js?v=0.0.3"></script>" & @CRLF & _ "<script src="/xiaoqiang/web/js/jquery.dialog.js?v=0.0.3"></script>" & @CRLF & _ "<script src="/xiaoqiang/web/js/jquery.cookie.js?v=0.0.3"></script>" & @CRLF & _ "<script>" & @CRLF & _ "(function(){" & @CRLF & _ " var hardwareModel = 'R3'," & @CRLF & _ " R1CM = hardwareModel === 'R1CM'," & @CRLF & _ " R1CL = hardwareModel === 'R1CL'," & @CRLF & _ " R1D = hardwareModel === 'R1D'," & @CRLF & _ " R2D = hardwareModel === 'R2D'," & @CRLF & _ " R3 = hardwareModel === 'R3';" & @CRLF & _ " var G_CONFIG = {" & @CRLF & _ " R1CM : R1CM," & @CRLF & _ " R1CL : R1CL," & @CRLF & _ " R1D: R1D," & @CRLF & _ " R2D: R2D," & @CRLF & _ " R3: R3" & @CRLF & _ " };" & @CRLF & _ " var G_FEATURES = $.parseJSON('{"hardware":{".name":"hardware",".type":"features","disk":"0",".index":4,".anonymous":false,"usb":"1"},"apps":{".name":"apps",".type":"features","apptc":"0",".anonymous":false,"qos":"1",".index":3},"wifi":{".name":"wifi",".type":"features","wifi24":"1","wifi50":"1","wifiguest":"1",".anonymous":false,".index":1},"apmode":{".name":"apmode",".type":"features",".index":2,"wifiapmode":"1",".anonymous":false,"lanapmode":"1"},"system":{".name":"system",".type":"features","shutdown":"0","i18n":"0","downloadlogs":"0",".anonymous":false,".index":0}}');" & @CRLF & _ " window['G_CONFIG'] = G_CONFIG;" & @CRLF & _ " window['G_FEATURES'] = G_FEATURES;" & @CRLF & _ "}())" & @CRLF & _ "</script>" & @CRLF & _ "" & @CRLF & _ "<script>" & @CRLF & _ "// reboot" & @CRLF & _ "var global_api_reboot = {" & @CRLF & _ " url : '/cgi-bin/luci/api/xqsystem/reboot'," & @CRLF & _ " param : {"client":"web"}" & @CRLF & _ "};" & @CRLF & _ "function reboot_window( needconfirm ) {" & @CRLF & _ " console.log( needconfirm );" & @CRLF & _ " var reboot = function(){" & @CRLF & _ " $.getJSON( global_api_reboot.url, global_api_reboot.param, function( rsp ) {" & @CRLF & _ " if( rsp.code !== 0 ){" & @CRLF & _ " $.alert( rsp.msg ).time( 1.5*1000 );" & @CRLF & _ " } else {" & @CRLF & _ " var ip = rsp.lanIp[0].ip;" & @CRLF & _ " rebootWait( {" & @CRLF & _ " lanIp : ip," & @CRLF & _ " action : '重启路由器'," & @CRLF & _ " refresh : true" & @CRLF & _ " } );" & @CRLF & _ " }" & @CRLF & _ " });" & @CRLF & _ " };" & @CRLF & _ " if ( typeof( needconfirm ) !== "undefined" && needconfirm === false ) {" & @CRLF & _ " reboot();" & @CRLF & _ " return;" & @CRLF & _ " }" & @CRLF & _ " $.confirm('确定重启路由器,重启将断开和小米路由器的连接。',function () {" & @CRLF & _ " var dlg = this;" & @CRLF & _ " reboot();" & @CRLF & _ " dlg.close();" & @CRLF & _ " return false;" & @CRLF & _ " });" & @CRLF & _ "}" & @CRLF & _ "// shutdown" & @CRLF & _ "function shutdown_window(){" & @CRLF & _ " $.confirm('是否确定关闭路由器,操作将断开和小米路由器的连接。', function () {" & @CRLF & _ " $.getJSON( '/cgi-bin/luci/api/xqsystem/shutdown', {}, function( rsp ){" & @CRLF & _ " if( rsp.code !== 0 ){" & @CRLF & _ " $.alert(rsp.msg).time( 1.5*1000 );" & @CRLF & _ " } else {" & @CRLF & _ " $.loadingDialog({" & @CRLF & _ " title: '关闭路由器'," & @CRLF & _ " content: '关机中,请等待路由器指示灯熄灭后再断开电源'" & @CRLF & _ " });" & @CRLF & _ " }" & @CRLF & _ " });" & @CRLF & _ " });" & @CRLF & _ "}" & @CRLF & _ "//reset" & @CRLF & _ "function reset_window( format ){" & @CRLF & _ "" & @CRLF & _ " var reset = (function( format ){" & @CRLF & _ " var requestURL = '/cgi-bin/luci/api/xqsystem/reset'," & @CRLF & _ " requestData = {" & @CRLF & _ " format: format ? 1 : 0" & @CRLF & _ " }," & @CRLF & _ " wait = function(){" & @CRLF & _ " rebootWait( {" & @CRLF & _ " action : '恢复出厂设置'," & @CRLF & _ " refresh : true," & @CRLF & _ " lanIp: '192.168.31.1'" & @CRLF & _ " } );" & @CRLF & _ " }," & @CRLF & _ " clearCookies = function (){" & @CRLF & _ " var keys = document.cookie.match(/[^ =;]+(?=\=)/g);" & @CRLF & _ " if ( keys ) {" & @CRLF & _ " for (var i = keys.length; i--;){" & @CRLF & _ " document.cookie = keys[i]+'=0;path=/;expires=' + new Date(0).toUTCString();" & @CRLF & _ " }" & @CRLF & _ " }" & @CRLF & _ " };" & @CRLF & _ "" & @CRLF & _ " return function(){" & @CRLF & _ " $.getJSON( requestURL , requestData, function( rsp ) {" & @CRLF & _ " if ( rsp.code !== 0 ) {" & @CRLF & _ " $.alert( rsp.msg ).time( 3*1000 );" & @CRLF & _ " }else{" & @CRLF & _ " // clear cookies" & @CRLF & _ " clearCookies();" & @CRLF & _ " //block wait" & @CRLF & _ " wait();" & @CRLF & _ " }" & @CRLF & _ " });" & @CRLF & _ " }" & @CRLF & _ " })( format );" & @CRLF & _ "" & @CRLF & _ " $.confirm('确定要恢复出厂设置让小米路由器回到初始状态?', function(){" & @CRLF & _ " reset();" & @CRLF & _ " });" & @CRLF & _ "}" & @CRLF & _ "</script>" & @CRLF & _ "<script type="text/tmpl" id="tplrename">" & @CRLF & _ "<div class="mod-rename-dlg">" & @CRLF & _ " <p class="img"><img src="/xiaoqiang/web/img/topograph/router_r3_101.png"></p>" & @CRLF & _ " <div class="form-rename">" & @CRLF & _ " <form action="#" class="form" id="routerNameEdit">" & @CRLF & _ " <div class="form-item">" & @CRLF & _ " <label class="k">路由器名称</label>" & @CRLF & _ " <span class="v">" & @CRLF & _ " <input type="text" name="routername" id="routername" class="ipt-text" autocomplete="off" datatype="bytetext" maxlength="24" reqMsg="路由器名称" value="{$name}">" & @CRLF & _ " </span>" & @CRLF & _ " <em class="t"></em>" & @CRLF & _ " </div>" & @CRLF & _ " <div class="form-item">" & @CRLF & _ " <label class="k">位置</label>" & @CRLF & _ " <span class="v">" & @CRLF & _ " <input type="text" name="locale" id="locale" class="ipt-text" autocomplete="off" datatype="bytetext" maxlength="24" reqMsg="路由器位置" value="{$locale}">" & @CRLF & _ " </span>" & @CRLF & _ " <em class="t"></em>" & @CRLF & _ " </div>" & @CRLF & _ " <div class="form-contral">" & @CRLF & _ " <button type="submit" class="btn btn-primary btn-l"><span>保存</span></button>" & @CRLF & _ " </div>" & @CRLF & _ " </form>" & @CRLF & _ " </div>" & @CRLF & _ "</div>" & @CRLF & _ "</script>" & @CRLF & _ "<script type="text/tmpl" id="tplshutdown">" & @CRLF & _ "<div class="mod-reboot-dlg">" & @CRLF & _ " <p class="img"><img src="/xiaoqiang/web/img/ico_shutdown.png"></p>" & @CRLF & _ " <p class="text">关闭路由器将断开其他设备的数据访问和网络连接,之后便可以安全的断开电源。(再次启动需要手工连接电源)</p>" & @CRLF & _ " <button id="shutdownAction" type="button" class="btn btn-primary btn-l"><span>关闭路由器</span></button>" & @CRLF & _ "</div>" & @CRLF & _ "</script>" & @CRLF & _ "<script type="text/tmpl" id="tplreboot">" & @CRLF & _ "<div class="mod-shutdown-dlg">" & @CRLF & _ " <p class="img"><img src="/xiaoqiang/web/img/ico_reboot.png"></p>" & @CRLF & _ " <p class="text">路由器重启需要等待十几秒或更多时间,重启过程中将会断开网络连接,稍后将自动重新连接网络。</p>" & @CRLF & _ " <button type="button" id="rebootAction" class="btn btn-primary btn-l"><span>重启路由器</span></button>" & @CRLF & _ "</div>" & @CRLF & _ "</script>" & @CRLF & _ "<script type="text/tmpl" id="tpldownloadclient">" & @CRLF & _ "<div class="mod-downloadclient-dlg">" & @CRLF & _ " <table>" & @CRLF & _ " <tr>" & @CRLF & _ " <td>" & @CRLF & _ " <i class="ico-down-client ico-down-pc"></i>" & @CRLF & _ " <a href="http://bigota.miwifi.com/xiaoqiang/client/xqpc_client.exe">PC客户端</a>" & @CRLF & _ " </td>" & @CRLF & _ " <td class="c1"></td>" & @CRLF & _ " <td class="c2"></td>" & @CRLF & _ " <td>" & @CRLF & _ " <i class="ico-down-client ico-down-mac"></i>" & @CRLF & _ " <a href="http://bigota.miwifi.com/xiaoqiang/client/xqmac_client.dmg">MAC客户端</a>" & @CRLF & _ " </td>" & @CRLF & _ " </tr>" & @CRLF & _ " <tr class="last">" & @CRLF & _ " <td>" & @CRLF & _ " <i class="ico-down-client ico-down-andriod"></i>" & @CRLF & _ " " & @CRLF & _ " <a href="http://bigota.miwifi.com/xiaoqiang/client/xqapp_dev.apk">Android客户端</a>" & @CRLF & _ " <img class="onlineimg" src-local="/xiaoqiang/web/img/2dcode.png" src="http://www1.miwifi.com/statics/img/wf_2dcode_an_dl_dev.png">" & @CRLF & _ " " & @CRLF & _ " </td>" & @CRLF & _ " <td class="c1"></td>" & @CRLF & _ " <td class="c2"></td>" & @CRLF & _ " <td>" & @CRLF & _ " <i class="ico-down-client ico-down-iphone"></i>" & @CRLF & _ " <a href="https://itunes.apple.com/cn/app/id859962702?mt=8&ls=1">iPhone客户端</a>" & @CRLF & _ " <img class="onlineimg" src-local="/xiaoqiang/web/img/2dcode.png" src="http://www1.miwifi.com/statics/img/wf_2dcode_ios_dl.png">" & @CRLF & _ " </td>" & @CRLF & _ " </tr>" & @CRLF & _ " </table>" & @CRLF & _ "</div>" & @CRLF & _ "</script>" & @CRLF & _ "<script>" & @CRLF & _ "var DEBUG = false;" & @CRLF & _ "if ( !window.console || DEBUG == false) {" & @CRLF & _ " window.console = {" & @CRLF & _ " log: function(){}" & @CRLF & _ " };" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "var Encrypt = {" & @CRLF & _ " key: 'a2ffa5c9be07488bbb04a3a47d3c5f6a'," & @CRLF & _ " iv: '64175472480004614961023454661220'," & @CRLF & _ " nonce: null," & @CRLF & _ " init: function(){" & @CRLF & _ " var nonce = this.nonceCreat();" & @CRLF & _ " this.nonce = nonce;" & @CRLF & _ " return this.nonce;" & @CRLF & _ " }," & @CRLF & _ " nonceCreat: function(){" & @CRLF & _ " var type = 0;" & @CRLF & _ " var deviceId = '30:65:ec:3b:e2:9a';" & @CRLF & _ " var time = Math.floor(new Date().getTime() / 1000);" & @CRLF & _ " var random = Math.floor(Math.random() * 10000);" & @CRLF & _ " return [type, deviceId, time, random].join('_');" & @CRLF & _ " }," & @CRLF & _ " oldPwd : function(pwd){" & @CRLF & _ " return CryptoJS.SHA1(this.nonce + CryptoJS.SHA1(pwd + this.key).toString()).toString();" & @CRLF & _ " }," & @CRLF & _ " newPwd: function(pwd, newpwd){" & @CRLF & _ " var key = CryptoJS.SHA1(pwd + this.key).toString();" & @CRLF & _ " key = CryptoJS.enc.Hex.parse(key).toString();" & @CRLF & _ " key = key.substr(0, 32);" & @CRLF & _ " key = CryptoJS.enc.Hex.parse(key);" & @CRLF & _ " var password = CryptoJS.SHA1(newpwd + this.key).toString();" & @CRLF & _ " var iv = CryptoJS.enc.Hex.parse(this.iv);" & @CRLF & _ " var aes = CryptoJS.AES.encrypt(" & @CRLF & _ " password," & @CRLF & _ " key," & @CRLF & _ " {iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }" & @CRLF & _ " ).toString();" & @CRLF & _ " return aes;" & @CRLF & _ " }" & @CRLF & _ "};" & @CRLF & _ "" & @CRLF & _ "var pingRouter = function( on, off, ip ){" & @CRLF & _ " var online = on || function(){}," & @CRLF & _ " offline = off || function(){}," & @CRLF & _ " host = ip || location.host," & @CRLF & _ " imgUrl = 'http://' + host + '/xiaoqiang/web/img/logo.png'," & @CRLF & _ " time = 5000," & @CRLF & _ " timecounter = 0," & @CRLF & _ " img = null," & @CRLF & _ " wait = function(){" & @CRLF & _ " console.log('pingRouter:wait');" & @CRLF & _ " offline();" & @CRLF & _ " }," & @CRLF & _ " done = function(){" & @CRLF & _ " console.log('pingRouter:done');" & @CRLF & _ " window.clearInterval( timer );" & @CRLF & _ " online();" & @CRLF & _ " }," & @CRLF & _ " loadImg = function( onload, onerror ){" & @CRLF & _ " img = new Image();" & @CRLF & _ " img.onload = onload;" & @CRLF & _ " img.onerror = onerror;" & @CRLF & _ " img.src = imgUrl+'?' + (+new Date());" & @CRLF & _ " }," & @CRLF & _ " timer = window.setInterval(function() {" & @CRLF & _ "" & @CRLF & _ " if ( 'onLine' in navigator ) {" & @CRLF & _ " if ( navigator.onLine ) {" & @CRLF & _ " loadImg(" & @CRLF & _ " function(){" & @CRLF & _ " done();" & @CRLF & _ " }, function(){" & @CRLF & _ " wait();" & @CRLF & _ " }" & @CRLF & _ " );" & @CRLF & _ " } else {" & @CRLF & _ " wait();" & @CRLF & _ " }" & @CRLF & _ " }else{" & @CRLF & _ " loadImg(function(){" & @CRLF & _ " done();" & @CRLF & _ " }, function(){" & @CRLF & _ " wait();" & @CRLF & _ " });" & @CRLF & _ " }" & @CRLF & _ " }, time );" & @CRLF & _ "};" & @CRLF & _ "" & @CRLF & _ "var rebootWait = function ( opt ) {" & @CRLF & _ " var action = opt.action," & @CRLF & _ " ip = opt.lanIp || window.location.host," & @CRLF & _ " refresh = opt.refresh || false," & @CRLF & _ " tStart = ( +new Date() )," & @CRLF & _ " tUse," & @CRLF & _ " dlgRebootWait = $.loadingDialog({" & @CRLF & _ " title : '重启中...'," & @CRLF & _ " content : action + '操作生效,等待设备重启...'" & @CRLF & _ " })," & @CRLF & _ " online = function(){" & @CRLF & _ " dlgRebootWait.content( '操作生效,重启成功!' );" & @CRLF & _ " dlgRebootWait.time( 3*1000 );" & @CRLF & _ " if( refresh ){" & @CRLF & _ " window.setTimeout( 'window.top.location.href="http://'+ip+'";',3000 );" & @CRLF & _ " }" & @CRLF & _ " }," & @CRLF & _ " offline = function(){" & @CRLF & _ " tUse = Math.round( ( ( +new Date() ) - tStart ) / 1000 );" & @CRLF & _ " if ( tUse > 150 ) {" & @CRLF & _ " dlgRebootWait.content( '自动连接路由器失败,请检查无线或者网线是否连接正确。' );" & @CRLF & _ " return;" & @CRLF & _ " }" & @CRLF & _ " dlgRebootWait.content( action + ', 等待自动跳转... 用时{$time}秒'.tmpl({time: tUse}) );" & @CRLF & _ " };" & @CRLF & _ "" & @CRLF & _ " window.setTimeout( function(){" & @CRLF & _ " pingRouter( online, offline, ip );" & @CRLF & _ " }, 1000 * 60 );" & @CRLF & _ "};" & @CRLF & _ "" & @CRLF & _ "(function( $ ){" & @CRLF & _ "" & @CRLF & _ " function formInit( container ) {" & @CRLF & _ " var clsInput = 'form-item form-item-input'," & @CRLF & _ " clsEmpty = 'form-item form-item-empty'," & @CRLF & _ " clsDisabled = 'form-item-disabled'," & @CRLF & _ " clsError = 'form-item-err'," & @CRLF & _ " clsPassword = 'form-item-pwd';" & @CRLF & _ "" & @CRLF & _ " container = container || 'body';" & @CRLF & _ " $(container).find( '.form-item input' ).each(function(){" & @CRLF & _ " var me = this," & @CRLF & _ " $me = $( me )," & @CRLF & _ " parent = $( me.parentNode.parentNode )," & @CRLF & _ " label = parent.find( '.k' )," & @CRLF & _ " offsetX = $me.position().left;" & @CRLF & _ " if ( !( this.type == 'text' || this.type == 'password' ) ) {" & @CRLF & _ " return;" & @CRLF & _ " }" & @CRLF & _ " // some input do not need init" & @CRLF & _ " if ($me.hasClass('no-init')) {" & @CRLF & _ " return;" & @CRLF & _ " }" & @CRLF & _ " if ( me.value !=='' ) {" & @CRLF & _ " parent[0].className = clsInput;" & @CRLF & _ " } else {" & @CRLF & _ " parent[0].className = clsEmpty;" & @CRLF & _ " if ( offsetX > 0 ) {" & @CRLF & _ " label.css({ 'left': offsetX + 10 });" & @CRLF & _ " }" & @CRLF & _ " }" & @CRLF & _ " if ( me.disabled ) {" & @CRLF & _ " parent.addClass( clsDisabled );" & @CRLF & _ " }" & @CRLF & _ " if ( $me.attr('data-type') === 'password' ) {" & @CRLF & _ " parent.addClass( clsPassword );" & @CRLF & _ " parent.append( '<i class="bt-showpwd bt-showpwd-off"></i>' );" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " label.on( 'click', function(e){" & @CRLF & _ " try {" & @CRLF & _ " me.focus();" & @CRLF & _ " } catch ( ex ) {}" & @CRLF & _ " });" & @CRLF & _ "" & @CRLF & _ " });" & @CRLF & _ " var focusHandler = function(){" & @CRLF & _ " if ( !( this.type == 'text' || this.type == 'password' ) ) {" & @CRLF & _ " return;" & @CRLF & _ " }" & @CRLF & _ " var me = $( this )," & @CRLF & _ " parent = $( this.parentNode.parentNode )," & @CRLF & _ " label = parent.find( '.k' )," & @CRLF & _ " t = parent.find( '.t' )," & @CRLF & _ " classname;" & @CRLF & _ " if (me.hasClass('no-init')) {" & @CRLF & _ " return;" & @CRLF & _ " }" & @CRLF & _ " if ( parent.hasClass( clsPassword ) ) {" & @CRLF & _ " classname = clsInput + ' ' + clsPassword;" & @CRLF & _ " } else {" & @CRLF & _ " classname = clsInput;" & @CRLF & _ " }" & @CRLF & _ " if ( parent.hasClass( clsError ) ) {" & @CRLF & _ " t.hide();" & @CRLF & _ " }" & @CRLF & _ " label.css({ 'left': 'auto' });" & @CRLF & _ " label.hide();" & @CRLF & _ " parent[0].className = classname;" & @CRLF & _ " };" & @CRLF & _ " var blurHandler = function(){" & @CRLF & _ " var me = this," & @CRLF & _ " $me = $( me )," & @CRLF & _ " parent = $( me.parentNode.parentNode )," & @CRLF & _ " classname," & @CRLF & _ " label = parent.find( '.k' )," & @CRLF & _ " offsetX = $me.position().left;" & @CRLF & _ " if ( !( this.type == 'text' || this.type == 'password' ) ) {" & @CRLF & _ " return;" & @CRLF & _ " }" & @CRLF & _ " if ($(this).hasClass('no-init')) {" & @CRLF & _ " return;" & @CRLF & _ " }" & @CRLF & _ " label.show();" & @CRLF & _ " if ( me.value == '' ) {" & @CRLF & _ " if ( parent.hasClass( clsPassword ) ) {" & @CRLF & _ " classname = clsEmpty + ' ' + clsPassword;" & @CRLF & _ " } else {" & @CRLF & _ " classname = clsEmpty;" & @CRLF & _ " }" & @CRLF & _ " if ( offsetX > 0 ) {" & @CRLF & _ " label.css({ 'left': offsetX + 10 });" & @CRLF & _ " } else {" & @CRLF & _ " label.css({ 'left': 12 });" & @CRLF & _ " }" & @CRLF & _ " parent[0].className = classname;" & @CRLF & _ " }" & @CRLF & _ " };" & @CRLF & _ " function addInputEvent() {" & @CRLF & _ " $(container).find( '.form-item input' )" & @CRLF & _ " .on( 'focus', focusHandler )" & @CRLF & _ " .on( 'blur', blurHandler );" & @CRLF & _ " };" & @CRLF & _ "" & @CRLF & _ " function delInputEvent() {" & @CRLF & _ " $(container).find( '.form-item input' ).off( 'focus', focusHandler );" & @CRLF & _ " $(container).find( '.form-item input' ).off( 'blur', blurHandler );" & @CRLF & _ " };" & @CRLF & _ " // del password event" & @CRLF & _ " $( 'body' ).undelegate( '.bt-showpwd', 'click' );" & @CRLF & _ " $( 'body' ).delegate( '.bt-showpwd', 'click', function(e) {" & @CRLF & _ " console.log( 'showpwd' );" & @CRLF & _ " var me = this," & @CRLF & _ " meclass = 'bt-showpwd'," & @CRLF & _ " formItem = $(this).closest('.form-item')," & @CRLF & _ " input = formItem.find('input')," & @CRLF & _ " inputValue = input.val()," & @CRLF & _ " inputWrap = formItem.find('.v')," & @CRLF & _ " newinput = ''," & @CRLF & _ " inputHTML = inputWrap.html();" & @CRLF & _ "" & @CRLF & _ " if( input.attr('type') == 'password' ){" & @CRLF & _ " newinput = inputHTML.replace( /type\s*=\s*('|")?password('|")?/ig, 'type="text"');" & @CRLF & _ " inputWrap.html( newinput ).find('input')[0].value = inputValue;" & @CRLF & _ " me.className = meclass + ' bt-showpwd-on';" & @CRLF & _ " }else{" & @CRLF & _ " newinput = inputHTML.replace( /type\s*=\s*('|")?text('|")?/ig, 'type="password"');" & @CRLF & _ " inputWrap.html( newinput ).find('input')[0].value = inputValue;" & @CRLF & _ " me.className = meclass + ' bt-showpwd-off';" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " setTimeout( function() {" & @CRLF & _ " delInputEvent();" & @CRLF & _ " addInputEvent();" & @CRLF & _ " }, 0 );" & @CRLF & _ " });" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ " addInputEvent();" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " $.formInit = formInit;" & @CRLF & _ "" & @CRLF & _ "})(jQuery);" & @CRLF & _ "" & @CRLF & _ "/**" & @CRLF & _ "* byte format" & @CRLF & _ "*/" & @CRLF & _ "function byteFormat(number, precision, isarray){" & @CRLF & _ " var val," & @CRLF & _ " label," & @CRLF & _ " ret;" & @CRLF & _ " precision = precision || 100," & @CRLF & _ " isarray = isarray || false;" & @CRLF & _ " if (number > 1024 * 1024 * 1024) {" & @CRLF & _ " val = Math.floor( number / 1024 / 1024 / 1024 * precision ) / precision;" & @CRLF & _ " label = 'GB';" & @CRLF & _ " } else if (number > 1024 * 1024 && number < 1024 * 1024 * 1024){" & @CRLF & _ " val = Math.floor( number / 1024 / 1024 * precision ) / precision;" & @CRLF & _ " label = 'MB';" & @CRLF & _ " }else{" & @CRLF & _ " val = Math.floor( number / 1024 * precision ) / precision;" & @CRLF & _ " label = 'KB';" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " if (isarray) {" & @CRLF & _ " ret = [val, label];" & @CRLF & _ " }else{" & @CRLF & _ " ret = val + label;" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " return ret;" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "function secondToHour(time){" & @CRLF & _ " var pint = function(num){" & @CRLF & _ " return parseInt(num, 10);" & @CRLF & _ " }," & @CRLF & _ " hour = pint(time / 3600.0)," & @CRLF & _ " minute = pint((parseFloat(time / 3600.0) - hour) * 60)," & @CRLF & _ " second = pint(time) - hour * 3600 - minute * 60," & @CRLF & _ " format = hour + '小时' + minute + '分' + second + '秒';" & @CRLF & _ " return format;" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "function secondToDate(second) {" & @CRLF & _ " var time = parseFloat(second)," & @CRLF & _ " pint = function(num){" & @CRLF & _ " return parseInt(num, 10);" & @CRLF & _ " }," & @CRLF & _ " day;" & @CRLF & _ " if (time !== null && time !== "") {" & @CRLF & _ " if (time > 60 && time < 60 * 60) {" & @CRLF & _ " time = pint(time / 60.0) + '分' + pint((parseFloat(time / 60.0) - pint(time / 60.0, 10)) * 60) + '秒';" & @CRLF & _ " }" & @CRLF & _ " else if (time >= 60 * 60 && time < 60 * 60 * 24) {" & @CRLF & _ " time = secondToHour(time);" & @CRLF & _ " }else if (time >= 24* 60 * 60 ) {" & @CRLF & _ " day = pint(time / (3600.0 * 24) );" & @CRLF & _ " time = time - (day * 3600 * 24);" & @CRLF & _ " time = day + '天 ' + secondToHour(time);" & @CRLF & _ " }" & @CRLF & _ " else {" & @CRLF & _ " time = pint(time) + '秒';" & @CRLF & _ " }" & @CRLF & _ " }" & @CRLF & _ " return time;" & @CRLF & _ "}" & @CRLF & _ "" & @CRLF & _ "(function( $ ){" & @CRLF & _ " function pint(num){" & @CRLF & _ " return parseInt(num, 10);" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " function secondToHour(time){" & @CRLF & _ " var hour = pint(time / 3600.0)," & @CRLF & _ " minute = pint((parseFloat(time / 3600.0) - hour) * 60)," & @CRLF & _ " second = pint(time) - hour * 3600 - minute * 60," & @CRLF & _ " format = hour + '小时' + minute + '分' + second + '秒';" & @CRLF & _ " return format;" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " function secondToDate(second) {" & @CRLF & _ " var time = parseFloat(second)," & @CRLF & _ " day;" & @CRLF & _ " if (time !== null && time !== "") {" & @CRLF & _ " if (time > 60 && time < 60 * 60) {" & @CRLF & _ " time = pint(time / 60.0) + '分' + pint((parseFloat(time / 60.0) - pint(time / 60.0, 10)) * 60) + '秒';" & @CRLF & _ " }" & @CRLF & _ " else if (time >= 60 * 60 && time < 60 * 60 * 24) {" & @CRLF & _ " time = secondToHour(time);" & @CRLF & _ " }else if (time >= 24* 60 * 60 ) {" & @CRLF & _ " day = pint(time / (3600.0 * 24) );" & @CRLF & _ " time = time - (day * 3600 * 24);" & @CRLF & _ " time = day + '天' + secondToHour(time);" & @CRLF & _ " }" & @CRLF & _ " else {" & @CRLF & _ " time = pint(time) + '秒';" & @CRLF & _ " }" & @CRLF & _ " }" & @CRLF & _ " return time;" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " function secondToDate2(second) {" & @CRLF & _ " var time = parseFloat(second)," & @CRLF & _ " num = 0," & @CRLF & _ " unit = '天';" & @CRLF & _ " console.log( second, time );" & @CRLF & _ " if (!isNaN(time)) {" & @CRLF & _ " if (time > 60 && time < 60 * 60) {" & @CRLF & _ " num = Math.floor(time / 60.0);" & @CRLF & _ " unit = '分钟';" & @CRLF & _ " } else if (time >= 60 * 60 && time < 60 * 60 * 24) {" & @CRLF & _ " num = Math.floor(time / 3600.0);" & @CRLF & _ " unit = '小时'" & @CRLF & _ " } else if (time >= 24 * 60 * 60 ) {" & @CRLF & _ " num = Math.floor( time / (3600.0 * 24) );" & @CRLF & _ " unit = '天';" & @CRLF & _ " } else {" & @CRLF & _ " num = Math.floor(time);" & @CRLF & _ " unit = '秒';" & @CRLF & _ " }" & @CRLF & _ " }" & @CRLF & _ " return {" & @CRLF & _ " num: num," & @CRLF & _ " unit: unit" & @CRLF & _ " };" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " $.secondToHour = secondToHour;" & @CRLF & _ " $.secondToDate = secondToDate;" & @CRLF & _ " $.secondToDate2 = secondToDate2;" & @CRLF & _ "})( jQuery );" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "$( document ).ajaxSuccess( function( event, xhr, settings ) {" & @CRLF & _ " var rsp = xhr.responseText;" & @CRLF & _ " rsp = $.parseJSON( rsp );" & @CRLF & _ " // console.log(event, xhr, settings);" & @CRLF & _ " var ignore = [" & @CRLF & _ " 'api\/xqsystem\/login'," & @CRLF & _ " 'api\/xqsystem\/upgrade_rom'" & @CRLF & _ " ];" & @CRLF & _ " for (var i = 0; i < ignore.length; i++) {" & @CRLF & _ " var ignoreTest = new RegExp(ignore[i]);" & @CRLF & _ " // console.log( ignoreTest );" & @CRLF & _ " if ( ignoreTest.test( settings.url ) ) {" & @CRLF & _ " return;" & @CRLF & _ " }" & @CRLF & _ " }" & @CRLF & _ " if ( rsp.code === 401 || rsp.code === 403) {" & @CRLF & _ " document.location.href = 'http://' + location.host;" & @CRLF & _ " }" & @CRLF & _ "} );" & @CRLF & _ "" & @CRLF & _ "$.sub( 'wait', function( evt, data ){" & @CRLF & _ " var selector = data.id;" & @CRLF & _ " if ( !$.waitStatus) {" & @CRLF & _ " $.waitStatus = {};" & @CRLF & _ " }" & @CRLF & _ " $.waitStatus[selector] = $( selector ).text();" & @CRLF & _ " $( selector ).addClass('btn-primary-disabled').prop( 'disabled' , true ).find('span').text( '处理中...' );" & @CRLF & _ "} );" & @CRLF & _ "" & @CRLF & _ "$.sub( 'done', function( evt, data ){" & @CRLF & _ " var selector = data.id," & @CRLF & _ " text = $.waitStatus[selector];" & @CRLF & _ " $( selector ).removeClass('btn-primary-disabled').prop( 'disabled' , false ).find('span').text( text );" & @CRLF & _ "} );" & @CRLF & _ "" & @CRLF & _ "$.sub( 'loading:start', function(){" & @CRLF & _ " var isLoading = $('html').hasClass('isloading');" & @CRLF & _ " if ( isLoading ) {" & @CRLF & _ " return;" & @CRLF & _ " }" & @CRLF & _ " var tplMask = '<div id="panel-loading-mask" class="panel-mask" style="position:fixed;left:0;top:0;style:none;"></div>'," & @CRLF & _ " tplLoading = ''" & @CRLF & _ " +'<div id="panel-loading" class="panel-loading" style="style:none;">'" & @CRLF & _ " + '<img src="/img/loading2.gif">'" & @CRLF & _ " +'</div>'," & @CRLF & _ " $mask = $( tplMask )," & @CRLF & _ " $loading = $( tplLoading )," & @CRLF & _ " zIndex = 10000;" & @CRLF & _ " $mask.css({" & @CRLF & _ " 'z-index': zIndex," & @CRLF & _ " width: $(window).width() + 'px'," & @CRLF & _ " height: $(window).height() + 'px'" & @CRLF & _ " });" & @CRLF & _ " $loading.css({'z-index': zIndex + 1});" & @CRLF & _ " $mask.appendTo( document.body ).show();" & @CRLF & _ " $loading.appendTo( document.body ).show();" & @CRLF & _ " $('html').addClass('isloading');" & @CRLF & _ "} );" & @CRLF & _ "" & @CRLF & _ "$.sub( 'loading:stop', function(){" & @CRLF & _ " $('html').removeClass('isloading');" & @CRLF & _ " $('#panel-loading, #panel-loading-mask').remove();" & @CRLF & _ "});" & @CRLF & _ "" & @CRLF & _ "// dialog block loading" & @CRLF & _ "(function( $ ){" & @CRLF & _ " $.loadingDialog = function( config ){" & @CRLF & _ " var mix = ObjectH.mix," & @CRLF & _ " _config = config || {" & @CRLF & _ " title: ''," & @CRLF & _ " content: ''" & @CRLF & _ " }," & @CRLF & _ " conf = mix( _config, {" & @CRLF & _ " width: 390," & @CRLF & _ " padding:'25px 30px'," & @CRLF & _ " title: config.title," & @CRLF & _ " content: '<p style="padding-bottom:30px;">{$content}</p><div class="loading-bar"></div>'.tmpl({content: config.content})," & @CRLF & _ " cancel: false" & @CRLF & _ " }, true )," & @CRLF & _ " dialog = $.dialog( conf );" & @CRLF & _ "" & @CRLF & _ " var oldcontent = dialog.content;" & @CRLF & _ " dialog.content = function( cont ){" & @CRLF & _ " var _cont = '<p style="padding-bottom:30px;">{$content}</p><div class="loading-bar"></div>'.tmpl({content: cont});" & @CRLF & _ " return oldcontent.call( dialog, _cont);" & @CRLF & _ " };" & @CRLF & _ " return dialog;" & @CRLF & _ " }" & @CRLF & _ "})(jQuery);" & @CRLF & _ "" & @CRLF & _ "// dialog alert" & @CRLF & _ "(function( $ ){" & @CRLF & _ " $.alert = function( content, ok ){" & @CRLF & _ " ok = ok || function(){};" & @CRLF & _ " return $.dialog({" & @CRLF & _ " width: 390," & @CRLF & _ " padding:'25px 30px'," & @CRLF & _ " title: '提示信息'," & @CRLF & _ " content: content," & @CRLF & _ " ok: ok," & @CRLF & _ " cancel: false" & @CRLF & _ " });" & @CRLF & _ " }" & @CRLF & _ "})(jQuery);" & @CRLF & _ "" & @CRLF & _ "// dialog confirm" & @CRLF & _ "(function( $ ){" & @CRLF & _ " $.confirm = function( content, ok, cancel ){" & @CRLF & _ " var _cancel = cancel || function(){};" & @CRLF & _ " return $.dialog({" & @CRLF & _ " width: 390," & @CRLF & _ " padding:'25px 30px'," & @CRLF & _ " title: '确认信息'," & @CRLF & _ " content: content," & @CRLF & _ " ok: ok," & @CRLF & _ " cancel: _cancel," & @CRLF & _ " lock: true" & @CRLF & _ " });" & @CRLF & _ " }" & @CRLF & _ "})(jQuery);" & @CRLF & _ "" & @CRLF & _ "// wechat code dialog" & @CRLF & _ "$(function(){" & @CRLF & _ " $( '#wechatcode' ).click(function( e ){" & @CRLF & _ " e.preventDefault();" & @CRLF & _ " var $this = $( this )," & @CRLF & _ " href = $this.attr( 'href' );" & @CRLF & _ " $.dialog({" & @CRLF & _ " title: '官方微信'," & @CRLF & _ " content: '<img width="200" src="'+ href +'">'," & @CRLF & _ " width: 250," & @CRLF & _ " lock: true" & @CRLF & _ " });" & @CRLF & _ " });" & @CRLF & _ "});" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "// set sys language" & @CRLF & _ "(function($){" & @CRLF & _ " $.i18nSet = function( el ){" & @CRLF & _ " var $lan = $( el )," & @CRLF & _ " apiGetLan = '/cgi-bin/luci/api/xqsystem/get_languages'," & @CRLF & _ " apiSetlan = '/cgi-bin/luci/api/xqsystem/set_language'," & @CRLF & _ " dtd = $.Deferred();" & @CRLF & _ "" & @CRLF & _ " $.get(apiGetLan, function( rsp ){" & @CRLF & _ " var rsp = $.parseJSON( rsp );" & @CRLF & _ " var selectContent = [];" & @CRLF & _ " if ( rsp.code == 0 ) {" & @CRLF & _ " for (var i = 0; i < rsp.list.length; i++) {" & @CRLF & _ " var item = rsp.list[i]," & @CRLF & _ " selected = item.lang == rsp.lang ? 'selected' : ''," & @CRLF & _ " option = '<option value="' + item.lang + '" '+ selected +'>' + item['name'] + '</option>';" & @CRLF & _ " // clear old conf en item" & @CRLF & _ " if ( item.lang != 'en') {" & @CRLF & _ " selectContent.push(option);" & @CRLF & _ " }" & @CRLF & _ " };" & @CRLF & _ " $lan.html( selectContent.join('') );" & @CRLF & _ " dtd.resolve();" & @CRLF & _ " }" & @CRLF & _ " });" & @CRLF & _ "" & @CRLF & _ " $lan.on('change', function( e ){" & @CRLF & _ " var el = this," & @CRLF & _ " val = $(this).val();" & @CRLF & _ " $.pub('loading:start');" & @CRLF & _ " $.post(apiSetlan, {language: val}, function( rsp ){" & @CRLF & _ " var rsp = $.parseJSON( rsp );" & @CRLF & _ " if ( rsp.code == 0 ) {" & @CRLF & _ " location.reload( 1 );" & @CRLF & _ " } else {" & @CRLF & _ " $.alert( rsp.msg );" & @CRLF & _ " }" & @CRLF & _ " $.pub('loading:stop');" & @CRLF & _ " });" & @CRLF & _ " });" & @CRLF & _ "" & @CRLF & _ " return dtd.promise();" & @CRLF & _ " };" & @CRLF & _ "}(jQuery));" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "// global event" & @CRLF & _ "(function($){" & @CRLF & _ " var dlgReboot," & @CRLF & _ " dlgShutdown," & @CRLF & _ " dlgRouterName;" & @CRLF & _ " function getNotice(){" & @CRLF & _ " $.getJSON('/cgi-bin/luci/api/misystem/messages', function(rsp){" & @CRLF & _ " if ( rsp.code == 0 ) {" & @CRLF & _ " var classname;" & @CRLF & _ " if ( rsp.count > 0 ) {" & @CRLF & _ " classname = 'ico-notice-new';" & @CRLF & _ " } else {" & @CRLF & _ " classname = 'ico-notice';" & @CRLF & _ " }" & @CRLF & _ " $('#sysnotice')[0].className = classname;" & @CRLF & _ " var msgMap = {" & @CRLF & _ " '1': '<p>检测到最新版本为{$version},<a href="/cgi-bin/luci/web/setting/upgrade">点击此处立即升级</a>。</p>'," & @CRLF & _ " '3': '<p>5G Wi-Fi启动失败,<a target="_blank" href="http://www.mi.com/service/contact/">请联系小米客服解决</a></p>'," & @CRLF & _ " '4': '<p>检测到与上级路由器存在IP冲突,建议切换到<a href="/cgi-bin/luci/web/setting/wan#netmode">有线中继模式</a>或者<a href="#" id="ipconflict" data-ip="{$ip}">避让IP冲突</p>'" & @CRLF & _ " };" & @CRLF & _ " var msgHTML = [];" & @CRLF & _ " for (var i = rsp.messages.length - 1; i >= 0; i--) {" & @CRLF & _ " msgHTML.push(msgMap[rsp.messages[i].type].tmpl(rsp.messages[i].data));" & @CRLF & _ " };" & @CRLF & _ " $('#noticebar .content').html( msgHTML.join('') );" & @CRLF & _ "" & @CRLF & _ " if ( rsp.count > 0 ) {" & @CRLF & _ " $('#sysnotice').trigger('click');" & @CRLF & _ " }" & @CRLF & _ " }" & @CRLF & _ " });" & @CRLF & _ " }" & @CRLF & _ " function reNameHandler(e){" & @CRLF & _ " e.preventDefault();" & @CRLF & _ " $.getJSON('/cgi-bin/luci/api/misystem/router_name')" & @CRLF & _ " .done(function( rsp ){" & @CRLF & _ " if ( rsp.code == 0 ) {" & @CRLF & _ " var html = StringH.tmpl($('#tplrename').html() , {" & @CRLF & _ " locale: StringH.encode4HtmlValue(rsp.locale)," & @CRLF & _ " name: StringH.encode4HtmlValue(rsp.name)" & @CRLF & _ " });" & @CRLF & _ " dlgRouterName = $.dialog({" & @CRLF & _ " width: 390," & @CRLF & _ " title: '修改路由器名称'," & @CRLF & _ " content: html," & @CRLF & _ " lock: true" & @CRLF & _ " });" & @CRLF & _ " setTimeout(function(){" & @CRLF & _ " $.formInit('.mod-rename-dlg');" & @CRLF & _ " $.selectBeautify({container: '.mod-rename-dlg'});" & @CRLF & _ " }, 100);" & @CRLF & _ " }" & @CRLF & _ " });" & @CRLF & _ " }" & @CRLF & _ " function downloadClientHandler(e){" & @CRLF & _ " e.preventDefault();" & @CRLF & _ " $.dialog({" & @CRLF & _ " width: 390," & @CRLF & _ " title: '下载客户端'," & @CRLF & _ " content: $('#tpldownloadclient').html()," & @CRLF & _ " lock: true" & @CRLF & _ " });" & @CRLF & _ " setTimeout(function(){" & @CRLF & _ " $('.onlineimg').each(function(){" & @CRLF & _ " var img = new Image();" & @CRLF & _ " var el = this;" & @CRLF & _ " var remote = el.src;" & @CRLF & _ " var local = $(el).attr('src-local');" & @CRLF & _ " img.onerror = function(){" & @CRLF & _ " el.src = local;" & @CRLF & _ " }" & @CRLF & _ " img.src = remote;" & @CRLF & _ " });" & @CRLF & _ " }, 100);" & @CRLF & _ " }" & @CRLF & _ " function rebootHandler(e){" & @CRLF & _ " e.preventDefault();" & @CRLF & _ " dlgReboot = $.dialog({" & @CRLF & _ " width: 390," & @CRLF & _ " title: '重启路由器'," & @CRLF & _ " content: $('#tplreboot').html()," & @CRLF & _ " lock: true" & @CRLF & _ " });" & @CRLF & _ " }" & @CRLF & _ " function shutdownHandler(e){" & @CRLF & _ " e.preventDefault();" & @CRLF & _ " dlgShutdown = $.dialog({" & @CRLF & _ " width: 390," & @CRLF & _ " title: '路由器关机'," & @CRLF & _ " content: $('#tplshutdown').html()," & @CRLF & _ " lock: true" & @CRLF & _ " });" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " function noticeHandler(e){" & @CRLF & _ " e.preventDefault();" & @CRLF & _ " var that = this," & @CRLF & _ " $this = $(this)," & @CRLF & _ " pos = $('#userbar').position()," & @CRLF & _ " right," & @CRLF & _ " wt = 1160," & @CRLF & _ " wwt = $(window).width()," & @CRLF & _ " $arrow = $('#noticebar .ico-arrow');" & @CRLF & _ " if ( $this.hasClass('ico-notice-new') ) {" & @CRLF & _ " // right = wt - pos.left - 20;" & @CRLF & _ " $arrow.css({'right': '10px'});" & @CRLF & _ " $('#noticebar').css({'right': (wwt - wt) /2 });" & @CRLF & _ " $('#noticebar').toggle();" & @CRLF & _ " }" & @CRLF & _ " $('#maskMenu').height($(window).height());" & @CRLF & _ " $('#maskMenu').show();" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " function sysmenuHandler(e){" & @CRLF & _ " e.preventDefault();" & @CRLF & _ " var that = this," & @CRLF & _ " $this = $(this);" & @CRLF & _ " if ( $this.hasClass('s-dropdown') ){" & @CRLF & _ " var ww = $(window).width();" & @CRLF & _ " // var rt = (ww - 1160) / 2;" & @CRLF & _ " var lt = $this.offset().left + $this.outerWidth() - $('#dropmenu').width();" & @CRLF & _ " $('#dropmenu').css({left: lt});" & @CRLF & _ " $('#dropmenu').show();" & @CRLF & _ " that.className = 'name s-dropup';" & @CRLF & _ " }else{" & @CRLF & _ " $('#dropmenu').hide();" & @CRLF & _ " that.className = 'name s-dropdown';" & @CRLF & _ " }" & @CRLF & _ " $('#maskMenu').height($(window).height());" & @CRLF & _ " $('#maskMenu').show();" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " function maskHandler(e){" & @CRLF & _ " e.preventDefault();" & @CRLF & _ " $('#noticebar').hide();" & @CRLF & _ " $('#dropmenu').hide();" & @CRLF & _ " $('#maskMenu').hide();" & @CRLF & _ " $('#sysmenu')[0].className = 'name s-dropdown';" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " $(function(){" & @CRLF & _ " // notice" & @CRLF & _ " $('#sysnotice').click(noticeHandler);" & @CRLF & _ " // user dropmenu" & @CRLF & _ " $('#sysmenu').click(sysmenuHandler);" & @CRLF & _ " // space click" & @CRLF & _ " $('#maskMenu').click(maskHandler);" & @CRLF & _ " // rename" & @CRLF & _ " $( 'body' ).delegate( '#toRename', 'click', reNameHandler );" & @CRLF & _ " // toDownloadClient" & @CRLF & _ " $( 'body' ).delegate( '#toDownloadClient', 'click', downloadClientHandler );" & @CRLF & _ " // toReboot" & @CRLF & _ " $( 'body' ).delegate( '#toReboot', 'click', rebootHandler );" & @CRLF & _ " // toShutdown" & @CRLF & _ " $( 'body' ).delegate( '#toShutdown', 'click', shutdownHandler);" & @CRLF & _ "" & @CRLF & _ " $( 'body' ).delegate( '#shutdownAction', 'click', function( e ){" & @CRLF & _ " e.preventDefault();" & @CRLF & _ " dlgShutdown.close();" & @CRLF & _ " shutdown_window();" & @CRLF & _ " } );" & @CRLF & _ "" & @CRLF & _ " $( 'body' ).delegate( '#rebootAction', 'click', function( e ){" & @CRLF & _ " e.preventDefault();" & @CRLF & _ " dlgReboot.close();" & @CRLF & _ " reboot_window();" & @CRLF & _ " } );" & @CRLF & _ "" & @CRLF & _ " $( 'body' ).delegate( '#routerNameEdit', 'submit', function( e ){" & @CRLF & _ " e.preventDefault();" & @CRLF & _ " var validator = Valid.checkAll( this );" & @CRLF & _ " var routername = $('#routername').val();" & @CRLF & _ " var locale = $('#locale').val();" & @CRLF & _ " if ( validator ) {" & @CRLF & _ " $.getJSON('/cgi-bin/luci/api/misystem/set_router_name',{" & @CRLF & _ " name: routername," & @CRLF & _ " locale: locale" & @CRLF & _ " }).done(function(rsp){" & @CRLF & _ " if ( rsp.code == 0 ) {" & @CRLF & _ " location.reload(1);" & @CRLF & _ " } else {" & @CRLF & _ " $.alert( rsp.msg )" & @CRLF & _ " }" & @CRLF & _ " });" & @CRLF & _ " }" & @CRLF & _ " } );" & @CRLF & _ "" & @CRLF & _ " $( 'body' ).delegate('#ipconflict', 'click', function(e){" & @CRLF & _ " e.preventDefault();" & @CRLF & _ " var api = '/cgi-bin/luci/api/misystem/r_ip_conflict'," & @CRLF & _ " ip = $(this).attr('data-ip');" & @CRLF & _ " $.dialog({" & @CRLF & _ " title: '避让IP冲突'," & @CRLF & _ " content: '执行此操作,局域网IP将会变更为' + ip + '<br>' +'该过程无线网络会重启,将出现短暂掉线。'," & @CRLF & _ " lock: true," & @CRLF & _ " ok: function(){" & @CRLF & _ " $.post(api, function(rsp){" & @CRLF & _ " rsp = $.parseJSON(rsp);" & @CRLF & _ " if (rsp.code !== 0) {" & @CRLF & _ " alert(rsp.msg);" & @CRLF & _ " }" & @CRLF & _ " });" & @CRLF & _ " }," & @CRLF & _ " cancel: function(){}" & @CRLF & _ " });" & @CRLF & _ " });" & @CRLF & _ "" & @CRLF & _ " // user logined and has global header get notice" & @CRLF & _ " if ( typeof(GLOBALHEADER) !== 'undefined' && GLOBALHEADER === true ) {" & @CRLF & _ " getNotice();" & @CRLF & _ " }" & @CRLF & _ " });" & @CRLF & _ "})(jQuery);" & @CRLF & _ "</script>" & @CRLF & _ "<script src="/js/miwifi-monitor.js"></script>" & @CRLF & _ "<script>" & @CRLF & _ "// 流量统计" & @CRLF & _ "(function(){" & @CRLF & _ " var IS_MOBILE = (" & @CRLF & _ " navigator.userAgent.match(/Android/i)" & @CRLF & _ " || navigator.userAgent.match(/webOS/i)" & @CRLF & _ " || navigator.userAgent.match(/iPhone/i)" & @CRLF & _ " || navigator.userAgent.match(/iPad/i)" & @CRLF & _ " || navigator.userAgent.match(/iPod/i)" & @CRLF & _ " || navigator.userAgent.match(/BlackBerry/i)" & @CRLF & _ " || navigator.userAgent.match(/Windows Phone/i)" & @CRLF & _ " );" & @CRLF & _ " var PAGEURL = document.URL.split('/web/')[1];" & @CRLF & _ " var PAGE_MONITOR_CONF = {" & @CRLF & _ " deviceId: 'f051907f-3c7c-8667-a254-327d09463e2c'," & @CRLF & _ " isMobile: IS_MOBILE ? IS_MOBILE[0] : 'pc'," & @CRLF & _ " url: PAGEURL ? '/web/' + PAGEURL : '/web/login'," & @CRLF & _ " romVersion: '2.11.48'," & @CRLF & _ " romChannel: 'stable'," & @CRLF & _ " hardwareVersion: 'R3'" & @CRLF & _ " };" & @CRLF & _ " MIWIFI_MONITOR.setProject('MIWIFIWEB');" & @CRLF & _ " MIWIFI_MONITOR.log(PAGE_MONITOR_CONF, 'track');" & @CRLF & _ "" & @CRLF & _ " $(document).ajaxSend(function(event, jqxhr, settings) {" & @CRLF & _ " var apiUrl = settings.url.split('/api/')[1]," & @CRLF & _ " api = '/api/' + apiUrl.split('?')[0]," & @CRLF & _ " apiParams = StringH.queryUrl(apiUrl);" & @CRLF & _ "" & @CRLF & _ " // console.log(apiUrl, api, apiParams);" & @CRLF & _ "" & @CRLF & _ " var API_MONITOR_CONF = ObjectH.mix({element: 'apicall', api: api}, [PAGE_MONITOR_CONF, apiParams]);" & @CRLF & _ " // console.log(API_MONITOR_CONF);" & @CRLF & _ " MIWIFI_MONITOR.log(API_MONITOR_CONF);" & @CRLF & _ " });" & @CRLF & _ "}());" & @CRLF & _ "</script>" & @CRLF & _ "<script>" & @CRLF & _ "$(function(){" & @CRLF & _ " var pwdErrorCount = 0;" & @CRLF & _ " $( '#password' ).focus();" & @CRLF & _ "" & @CRLF & _ " $( '#password' ).on( 'keypress', function( e ) {" & @CRLF & _ " $('#rtloginform .form-item' ).removeClass( 'form-item-err' );" & @CRLF & _ " $('#rtloginform .form-item .t' ).hide();" & @CRLF & _ " });" & @CRLF & _ "" & @CRLF & _ " function buildUrl( s, token ){" & @CRLF & _ " if (!window.location.origin){" & @CRLF & _ " window.location.origin = window.location.protocol+"//"+window.location.host;" & @CRLF & _ " }" & @CRLF & _ " return window.location.origin + '/cgi-bin/luci/;stok=' + token+ '/web/setting/' + s;" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " function loginHandle ( e ) {" & @CRLF & _ " e.preventDefault();" & @CRLF & _ " var formObj = document.rtloginform;" & @CRLF & _ " var pwd = $( '#password' ).val();" & @CRLF & _ " if ( pwd == '') {" & @CRLF & _ " return;" & @CRLF & _ " }" & @CRLF & _ " var nonce = Encrypt.init();" & @CRLF & _ " var oldPwd = Encrypt.oldPwd( pwd );" & @CRLF & _ " var param = {" & @CRLF & _ " username: 'admin'," & @CRLF & _ " password: oldPwd," & @CRLF & _ " logtype: 2," & @CRLF & _ " nonce: nonce" & @CRLF & _ " };" & @CRLF & _ " $.pub('loading:start');" & @CRLF & _ " var url = '/cgi-bin/luci/api/xqsystem/login';" & @CRLF & _ " $.post( url, param, function( rsp ) {" & @CRLF & _ " $.pub('loading:stop');" & @CRLF & _ " var rsp = $.parseJSON( rsp );" & @CRLF & _ " if ( rsp.code == 0 ) {" & @CRLF & _ " var redirect," & @CRLF & _ " token = rsp.token;" & @CRLF & _ " if ( /action=wan/.test(location.href) ) {" & @CRLF & _ " redirect = buildUrl('wan', token);" & @CRLF & _ " } else if ( /action=lannetset/.test(location.href) ) {" & @CRLF & _ " redirect = buildUrl('lannetset', token);" & @CRLF & _ " } else {" & @CRLF & _ " redirect = rsp.url;" & @CRLF & _ " }" & @CRLF & _ " window.location.href = redirect;" & @CRLF & _ " } else if ( rsp.code == 403 ) {" & @CRLF & _ " window.location.reload();" & @CRLF & _ " } else {" & @CRLF & _ " pwdErrorCount ++;" & @CRLF & _ " var errMsg = '密码错误';" & @CRLF & _ " if (pwdErrorCount >= 4) {" & @CRLF & _ " errMsg = '多次密码错误,将禁止继续尝试';" & @CRLF & _ " }" & @CRLF & _ " Valid.fail( document.getElementById('password'), errMsg, false);" & @CRLF & _ " $( formObj )" & @CRLF & _ " .addClass( 'shake animated' )" & @CRLF & _ " .one( 'webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){" & @CRLF & _ " $('#password').focus();" & @CRLF & _ " $( this ).removeClass('shake animated');" & @CRLF & _ " } );" & @CRLF & _ " }" & @CRLF & _ " });" & @CRLF & _ " }" & @CRLF & _ " $( '#rtloginform' ).on( 'submit', loginHandle);" & @CRLF & _ " $( '#btnRtSubmit' ).on( 'click', loginHandle);" & @CRLF & _ " $.placeholder();" & @CRLF & _ "});" & @CRLF & _ "</script>" & @CRLF & _ "" Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH) ; 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