OK, this is code that I found a while back, and posted here.
ASP Classic - Insert text, Line breaks and Code
The issue that I had, or am still having now, is that I am giving the user the option to choose the tags they want to use.
They can have as many tags as they need in their post.
The issue with the code in the link above is that it will only do one tag hard coded.
So, that I have done is added an REGGEX into it, and it works GREAT! for the highlighting,
However, adding this in, has messed up the main function of this code FUNCTION, and that is.
It adds the line breaks to everything OUTSIDE of the Code tags.
The REGGEX that I used and works is this.
Function Reggex(strString, strPattern, strReplace)
Dim RE: Set RE = New RegExp
.Pattern = strPattern
.Global = True
.IgnoreCase = True
Reggex = .Replace(strString, strReplace)
fString = Reggex(fString, "\[code=(.*?)\](.*?)\[\/code=(.*?)\]", "<pre class=""line-numbers"" id=""code""><code class=""language-$1 demo"">$2</code></pre id=""code"">")
The original code is this. (Modified to work in my project)
CodeTags(1,1,1) = "[ code=sql]" ' Remove the space between the bracket,
CodeTags(1,2,1) = "[/ code=sql]" ' Remove the space between the bracket,
CodeTags(1,1,2) = "<pre class=""line-numbers"" id=""code""><code class=""language-sql demo"">"
CodeTags(1,2,2) = "</code></pre id=""code"">"
This is the entire script.