Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reg Exp help matching the { and }

Status
Not open for further replies.
can you give me the code that you used? the expression that you gave does allow }....

Known is handfull, Unknown is worldfull
 
Hi vbKris,

Thanks for replying! :)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Private Function fnsHTTPParse(byval vsMessageIn)
Dim vsMatches, vsMatch, vsTmp
Dim vrgHTTP, vrgMatches, vrgMatch
Dim vHTTPs

Set vHTTPs = server.CreateObject("Scripting.Dictionary")
Set vrgHTTP = new RegExp
vrgHTTP.Pattern="\bhttp://[A-Z0-9.\/\=\#\?\_\%\&\-\{\}]+\b"
vrgHTTP.IgnoreCase = true
vrgHTTP.Global = true
Set vrgMatches = vrgHTTP.Execute( vsMessageIn )
For Each vrgMatch in vrgMatches
if (Not vHTTPs.Exists(vrgMatch.Value)) Then
call vHTTPs.Add(vrgMatch.Value,vrgMatch.FirstIndex)
vsTmp = "<A HREF=""" & vrgMatch.value & """ TARGET=""_blank"" rel=""nofollow"">" & vrgMatch.value & "</A>"
vsMessageIn = Replace(vsMessageIn,vrgMatch.value,vsTmp)
End If
Next
fnsHTTPParse = vsMessageIn
End Function

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks a million!!

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
 
Hi,
This is for those who're looking for a solution for URL matching for Regular Expression. I've found the following solution which works for me:

(([^\s]+

basically, it will match anything that starts with either a http:// or a www. and ends with a <space>.
Note: The ending space is important. This is important note if your program automatically replaces any CRLF to a <BR>. So, if a txt is like:
this is my link: is a great site.
Your {CRLF} will be replaced with a <BR>:
this is my link: is a great site.

***Note that the RegExp will now matches:
The simple solution is to replace {CRLF} into "<BR> " (BR with a space after it (no qoutes).

Good luck!


~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
 
Sorry, amendments:
The simple solution is to replace {CRLF} into " <BR>" (BR with a space **BEFORE it (no qoutes)).

~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top