<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
    <title>美亚礼品卡邮件 &middot; 卡号提取工具</title>
    <meta charset="UTF-8" />
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="http://cdn.staticfile.org/twitter-bootstrap/3.1.1/css/bootstrap.min.css">
</head>
<body>
    <div class="navbar navbar-default navbar-static-top" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <a class="navbar-brand" href="#">美亚礼品卡邮件 &middot; 卡号提取工具</a>
            </div>
        </div>
    </div>
    <div class="container">
        <div class="form-group">
            <textarea class="form-control" id="content" rows="15" placeholder="请在此粘贴邮件内容" autofocus></textarea>
        </div>
        <div class="form-group text-center">
            <button type="button" class="btn btn-primary btn-lg btn-block" onclick="process()">提取</button>
        </div>
    </div>

    <script type="text/javascript">
        var $content = document.getElementById('content');

        function process (e) {
            var regexResult = $content.value.match(/(\w{4}-\w{6}-\w{4})\s+(\$[\d\.]+)/g);

            var result = {};

            regexResult.forEach(function (item) {
                var itemValue = item.split('\n');

                if (!result[itemValue[1]]) {
                    result[itemValue[1]] = [];
                }

                result[itemValue[1]].push(itemValue[0]);
            });

            var output = [];
            for (var amount in result) {
                var amountResult = result[amount];
                output.push(amount + ' * ' + amountResult.length);

                amountResult.forEach(function (item) {
                    output.push(item);
                });

                output.push('');
            }

            $content.value = output.join('\n');
            $content.select();
        }
    </script>

    <script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); // jshint ignore:line

        ga('create', 'UA-10113841-3', 'netputer.github.io');
        ga('send', 'pageview');
    </script>
</body>
</html>

Add Amazon Gift Card Extractor
Add Amazon Gift Card Extractor
