Hi. I have extreme difficulties adding a regular expression.
Reference to my_message.aspx +- line 815 <bdy1 = REPLACE(replace(replace(replace(r.....>
it is in bdy where I want to do a regular Expression replace.
Normall in Classic ASP, I would have don it like this:
'--------------------------------------
Dim myre, strInput
Set myre = New RegExp
strpattern = "\b[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}\b"
myre.Pattern="(" & strpattern & ")"
myre.IgnoreCase=True
myre.Global=True
bdy1 = myre.Replace(strInput,"mailAddressRemoved")
set re = nothing
'--------------------------------------------
but now this is .net, so I would assume that RegEx will work
something like this:
'--------------------------------
Public Dim regex As Regex = New Regex( _
"([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\."+ _
")|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})", _
RegexOptions.IgnoreCase _
Or RegexOptions.CultureInvariant _
Or RegexOptions.IgnorePatternWhitespace _
Or RegexOptions.Compiled _
)
Public Dim regexReplace As String = _
"EmailAddressRemoved"
Dim result As String = regex.Replace(InputText,regexReplace)
bdy1 = result
'-------------------------------
This all does create errors... no I must add that I'm not a .net programmer, but all the code that is just between asp indicators <% %> looks like regular asp to me, and the other within the script vb runat server tags look like vb for .net.
So I tried both the above between <script> tags as well as between <% tags, but neither seems to work.
I also tried the '' Imports System.Text.RegularExpressions at the top of the aspx page, with no results.
PLEASE give me some guideline.
Thanks