Skip to content

Instantly share code, notes, and snippets.

@dragonken
Last active August 29, 2015 14:22
Show Gist options
  • Save dragonken/3559bdff265c339f20e6 to your computer and use it in GitHub Desktop.
Save dragonken/3559bdff265c339f20e6 to your computer and use it in GitHub Desktop.
wagXgQ
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<div class="content">
<div class="panel panel-primary">
<div class="panel panel-heading">Input</div>
<div class="panel panel-body">
<ul>
<li>HK$3,003,500.00</li>
<li>HK$3,500.00</li>
<li>HK$3500.00</li>
<li>$3500.00</li>
<li>$3500</li>
<li>$300 AUD</li>
</ul>
</div>
</div>
<div class="panel panel-primary">
<div class="panel panel-heading">Output</div>
<div class="panel panel-body">
<div class="output"></div>
</div>
</div>
</div>
function getAllPrice() {
var markup = document.documentElement.innerHTML;
var arr=markup.match(/(HKD|USD|AUD)?(HK|US|AU)?\s*\$((\d+),?)+\.?\d{0,2}\s*(HKD|USD|AUD)?(HK|US|AU)?/ig);
return arr;
}
console.log(getAllPrice());
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<div class="content">
<div class="panel panel-primary">
<div class="panel panel-heading">Input</div>
<div class="panel panel-body">
<ul>
<li>HK$3,003,500.00</li>
<li>HK$3,500.00</li>
<li>HK$3500.00</li>
<li>$3500.00</li>
<li>$3500</li>
<li>$300 AUD</li>
</ul>
</div>
</div>
<div class="panel panel-primary">
<div class="panel panel-heading">Output</div>
<div class="panel panel-body">
<div class="output"></div>
</div>
</div>
</div>
function getAllPrice() {
var markup = document.documentElement.innerHTML;
var arr=markup.match(/(HKD|USD|AUD)?(HK|US|AU)?\s*\$((\d+),?)+\.?\d{0,2}\s*(HKD|USD|AUD)?(HK|US|AU)?/ig);
return arr;
}
console.log(getAllPrice());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment