Jump to content

Looking For Specific Words.


ckrudelux

Recommended Posts

Global. If you leave that out, the match method will only return the first match. Including it makes sure that we return all the matches.
What do I do if the text frase has specall letters like [, ], (, ), / and \ ??
Link to comment
Share on other sites

Yeah, those characters have special meaning in regular expressions. For them to be understood literally, put the escape slash in front of them. Example:s="123[abc";m = s.match(/3\[/);// m returns "3["

Link to comment
Share on other sites

Yeah, those characters have special meaning in regular expressions. For them to be understood literally, put the escape slash in front of them. Example:s="123[abc";m = s.match(/3\[/);// m returns "3["
I don't see why this isn't working.It just runs throuth the script and don't send the data it don't even add the text.
var thistext = document.getElementById('2052420').value;var thisfrase = /\[b\]/g;var result = thistext.match(thisfrase);var countStart = result.length;		var thisfrase = /\[\/b\]/g;var result = thistext.match(thisfrase);var countEnd = result.length;		if(countStart > countEnd){	var tagEnd = countStart - countEnd;			var count = 0;		while(count != endTag){		document.getElementById('2052420').value += "[/b]";				var count = ++count;	}}

Link to comment
Share on other sites

Are tagEnd and endTag supposed to be the same thing? That could be a problem.Some browsers will not like you re-declaring count, as here:var count = ++count;That statement can actually be simplified just to this:++count;I'm sure if you looked at your error console, you'd see error notices popping up about one or both of these.

Link to comment
Share on other sites

Are tagEnd and endTag supposed to be the same thing? That could be a problem.Some browsers will not like you re-declaring count, as here:var count = ++count;That statement can actually be simplified just to this:++count;I'm sure if you looked at your error console, you'd see error notices popping up about one or both of these.
No I don't get any errors :)
Link to comment
Share on other sites

No I don't get any errors :)
Well found a miss spelling got a new error. Which is really hard to explane...Couse in some condtions it works and other conditions it dont :SSo first my code checks if anything is left active.After that it counts how many start and end point it is and if to few end points it will add end point so they will be as meny as start points.Here is the weired part those things what is left active will get throuth the secound part but only them who are the same as the active one :S
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...