replacing characture
am 22.03.2007 04:22:20 von jeff
hey gang.
I am having a problem with something. I run an online tournament site.
With hosting for clans, more so then not, the clan tags contain charactures
like + { [ in front of the tag letters.
what I am having a problem with is if it starts with a +, it isn't picking
up the name correctly. If in a sql statement, it looks for a tag that starts
with a +, it won't find it. And sometimes, when it is supposed to move the
tag over in a bracket, it moves it without the +.
for example, +EcK+ is the tag, it will either not find it, or move it over
as EcK without the +'s.
is there any way around this?
i know for some strings, such as things with ' you can use
replace (request.form("var"), "'", "''")
but not sure about these other charactures.
any help out there??
it would be most appreciated
Re: replacing characture
am 22.03.2007 11:52:58 von exjxw.hannivoort
Jeff wrote on 22 mrt 2007 in microsoft.public.inetserver.asp.general:
> hey gang.
>
> I am having a problem with something. I run an online tournament site.
> With hosting for clans, more so then not, the clan tags contain
> charactures like + { [ in front of the tag letters.
> what I am having a problem with is if it starts with a +, it isn't
> picking up the name correctly. If in a sql statement, it looks for a
> tag that starts with a +, it won't find it. And sometimes, when it is
> supposed to move the tag over in a bracket, it moves it without the +.
>
> for example, +EcK+ is the tag, it will either not find it, or move it
> over as EcK without the +'s.
>
> is there any way around this?
> i know for some strings, such as things with ' you can use
>
> replace (request.form("var"), "'", "''")
>
> but not sure about these other charactures.
> any help out there??
> it would be most appreciated
Try regex. It has a seep learning curve but the results are fine.
======== vbs ==============
str1 = "+EcK+"
Set regEx = New RegExp
regEx.Pattern = "^[+{\(]"
' regEx.IgnoreCase = True
regEx.Global = True
str1 = regEx.Replace(str1, replStr)
==========================
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Re: replacing characture
am 22.03.2007 19:24:55 von jeff
"Evertjan." wrote in message
news:Xns98FB78E19454Beejj99@194.109.133.242...
> Jeff wrote on 22 mrt 2007 in microsoft.public.inetserver.asp.general:
>
>> hey gang.
>>
>> I am having a problem with something. I run an online tournament site.
>> With hosting for clans, more so then not, the clan tags contain
>> charactures like + { [ in front of the tag letters.
>> what I am having a problem with is if it starts with a +, it isn't
>> picking up the name correctly. If in a sql statement, it looks for a
>> tag that starts with a +, it won't find it. And sometimes, when it is
>> supposed to move the tag over in a bracket, it moves it without the +.
>>
>> for example, +EcK+ is the tag, it will either not find it, or move it
>> over as EcK without the +'s.
>>
>> is there any way around this?
>> i know for some strings, such as things with ' you can use
>>
>> replace (request.form("var"), "'", "''")
>>
>> but not sure about these other charactures.
>> any help out there??
>> it would be most appreciated
>
> Try regex. It has a seep learning curve but the results are fine.
>
>
>
>
> ======== vbs ==============
>
> str1 = "+EcK+"
> Set regEx = New RegExp
> regEx.Pattern = "^[+{\(]"
> ' regEx.IgnoreCase = True
> regEx.Global = True
> str1 = regEx.Replace(str1, replStr)
>
> ==========================
i believe i have the basic understanding of this.
however, when i run the code, and do a response.write str1
i get EcK+
isn't it supposed to replace both +'s?
<%
str1 = "+EcK+"
Set regEx = New RegExp
regEx.Pattern = "^[+{\(]"
' regEx.IgnoreCase = True
regEx.Global = True
str1 = regEx.Replace(str1, replStr)
response.write str1
%>
http://tournamentsbyeck.com/test.asp
Re: replacing characture
am 22.03.2007 20:27:54 von exjxw.hannivoort
Jeff wrote on 22 mrt 2007 in microsoft.public.inetserver.asp.general:
>> ======== vbs ==============
>>
>> str1 = "+EcK+"
>> Set regEx = New RegExp
>> regEx.Pattern = "^[+{\(]"
>> ' regEx.IgnoreCase = True
>> regEx.Global = True
>> str1 = regEx.Replace(str1, replStr)
>>
>> ==========================
>
>
> i believe i have the basic understanding of this.
> however, when i run the code, and do a response.write str1
>
> i get EcK+
> isn't it supposed to replace both +'s?
No , I thought you wanted only a leading char removed.
>
> <%
> str1 = "+EcK+"
> Set regEx = New RegExp
> regEx.Pattern = "^[+{\(]"
If you want all occurances of those three removes do this:
regEx.Pattern = "[+{\(]+"
> ' regEx.IgnoreCase = True
> ' regEx.Global = True
regEx.Global = True
> str1 = regEx.Replace(str1, replStr)
> response.write str1
>
> %>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Re: replacing characture
am 23.03.2007 00:10:49 von jeff
>
> I am having a problem with something. I run an online tournament site.
> With hosting for clans, more so then not, the clan tags contain
> charactures like + { [ in front of the tag letters.
> what I am having a problem with is if it starts with a +, it isn't picking
> up the name correctly. If in a sql statement, it looks for a tag that
> starts with a +, it won't find it. And sometimes, when it is supposed to
> move the tag over in a bracket, it moves it without the +.
>
> for example, +EcK+ is the tag, it will either not find it, or move it over
> as EcK without the +'s.
>
> is there any way around this?
> i know for some strings, such as things with ' you can use
>
> replace (request.form("var"), "'", "''")
>
> but not sure about these other charactures.
> any help out there??
> it would be most appreciated
>
Just wanted everyone to know, that using Server.URLEncode has solved this
problem. the problem was in the querystring
thanks again