Finding and changing currencies using Greasemonkey
Posted
by Noam Smadja
on Stack Overflow
See other posts from Stack Overflow
or by Noam Smadja
Published on 2010-04-11T20:55:00Z
Indexed on
2010/04/11
21:03 UTC
Read the original article
Hit count: 410
It doesnt find nor replaces the strings.. may be wrong regex?
// ==UserScript==
// @name CurConvertor
// @namespace CurConvertor
// @description noam smadja
// @include http://www.zavvi.com/*
// ==/UserScript==
textNodes = document.evaluate(
"//text()",
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
var searchRE = new RegExp('\d\d.\d\d','gi');
var replace = searchRE*5.67;
for (var i=0;i<textNodes.snapshotLength;i++) {
var node = textNodes.snapshotItem(i);
node.data = node.data.replace(searchRE, replace);
i wrote this, but its not doing a think. even when i change the string in the regex to a string in the webpage it still does nothing..
what am i missing? :)
© Stack Overflow or respective owner