Sure, JavaScript is great at stuff like this. Consider the following:
function NumberOfSubStrings(str, sub, case_insens)
{
var regexp = new RegExp(sub, "g" + (case_insens ? "i" : ""));
var result = str.match(regexp);
return result ? result.length : 0;
}
var str = "hi there this is a string";
return NumberOfSubStrings(str, "i");
This should return the number 4.
Similarly, you could call the function to look for <p> tags, like so:
var str = ""; // whatever you want
return NumberOfSubStrings(str, "<p>");
Keep in mind, though, that the <p> tags may have attributes. So you
may want to search for "<p" instead. Also, since tag names in
FusionPro are (generally) not case-sensitive, you should also look
for "<P>" tags. You can set the optional "case_insens" parameter to
true to match both, like so:
return NumberOfSubStrings(str, "<p", true);
Dan
--
Users of FusionPro Desktop have unlimited free email support. Contact Printable Support at [EMAIL PROTECTED]
--
View FusionPro Knowledge Base, FusionPro Samples at
www.printable.com/vdp/desktop.htm
--
You are currently subscribed to fusionpro as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
--
--
Note: All e-mail sent to or from this address will be received or otherwise
recorded by the e-mail recipients of this forum. It is subject to archival,
monitoring or review by, and/or disclosure to someone other than the recipient.
Our privacy policy is posted on www.printplanet.com
--