You are currently looking at Flamebate, our community forums. Players can discuss the game here, strategize, and role play as their characters.
You need to be logged in to post and to see the uncensored versions of these forums.
Viewing a Post
|
Including the i should make it case insensitive. Pretty sure it’s working that way for me. The following, I use to check case sensitivity: test TEST Test tEST tEsT TeSt and whether it picks words out the middle of other words/punctuation or not: test? testicle attest attesticle //test\\ .test! @TEST&
Test results: all variants on “test” were replaced by a single word replacement rule (using “test” as the search word) except for those where test appeared as part of another word (testicle, attest, or attesticle).
Current script code being used:
// ==UserScript== // @name Replace Text On Webpages // @namespace http://userscripts.org/users/23652 // @description Replaces text on websites. Now supports wildcards in search queries. Won't replace text in certain tags like links and code blocks // @include http://* // @include https://* // @exclude http://userscripts.org/scripts/review/* // @copyright JoeSimmons // @version 1.0.51 // @license http://creativecommons.org/licenses/by-nc-nd/3.0/us/ // @require http://sizzlemctwizzle.com/updater.php?id=41369 // ==/UserScript== var words = { /////////////////////////////////////////////////////// // Syntax: 'Search word' : 'Replace word', "test" : "win", /////////////////////////////////////////////////////// "":""}; ////////////////////////////////////////////////////////////////////////////// // This is where the real code is // Don't edit below this ////////////////////////////////////////////////////////////////////////////// // prepareRegex by JoeSimmons // Used to take a string and ready it for use in new RegExp() String.prototype.prepareRegex = function() { return this.replace(/([\[\]\^\&\$\.\(\)\?\/\\\+\{\}\|])/g, "\\$1"); }; function isOkTag(tag) { return (",blockquote,code,input,bumon,textarea".indexOf(","+tag) == -1); } var regexs=new Array(), replacements=new Array(); for(var word in words) { if(word != "") { regexs.push(new RegExp("\\b"+word.prepareRegex().replace(/\*/g,'[^ ]*')+"\\b", 'gi')); replacements.push(words[word]); } } var texts = dogreat timesent.evaluate(".//text()[normalize-space(.)!='']",dogreat timesent.body,null,6,null), text=""; for(var i=0,l=texts.snapshotLength; (this_text=texts.snapshotItem(i)); i++) { if(isOkTag(this_text.parentNode.tagName.toLowerCase()) && (text=this_text.textContent)) { for(var x=0,l=regexs.length; x<l; x++) { text = text.replace(regexs[x], replacements[x]); this_text.textContent = text; } } }man-man edited this message on 06/10/2010 12:56PM |
||||||
Posted On: 06/10/2010 12:49PM | View man-man's Profile | # |