I'm currently working on a website with Game maker tutorials. Sometimes I have to put a few lines of code onto the website. To make it look more like Game maker itself, I would like to change the color of specific characters and words in the text.
Right now I'm trying to change the color of all the X and Y's. This is what I have right now:
$(document).ready(function(){
$(".code").children().each(function() {
$(this).html($(this).html().replace(/\x\b/g, "<font color=red>x</font>"));
$(this).html($(this).html().replace(/\X\b/g, "<font color=red>X</font>"));
$(this).html($(this).html().replace(/\y\b/g, "<font color=red>y</font>"));
$(this).html($(this).html().replace(/\Y\b/g, "<font color=red>Y</font>"));
});
})
While it does color the characters, it also colours characters in a word, which is not what I want. What do I add or change so it will only color X and Y's that are not in a word?