i know you will ask why. this is the format for my vbulleten forum to make a
table.
now sometimes, there is more than one space between objects there. so i
would want to be able to take out the extra spaces so it would be like
now if removing the spaces is a big deal, then i won't care to do it.
but the question i have is basically how to do this.
i could replace "" with |, but then it would replace every space right?
I only need one space between replaced.
Hope I am not confusing folks out there.
If anyone can help, I would appreciate it
TIA
Bam
Re: replacing a space or something like that
am 01.04.2008 05:57:34 von Bam
> Not sure how the title should have been, but here goes
>
> I want to take txt that i copy from a table on a site
>
> ex
>
> someplayername 1bff911a47a2e3044c5f4f6a27d68533 4.xxx.203.xx
> 212.xxx.208.195 03/18/07 19:36:41
> someplayername2 1930ca7a22e0985c4241b859a06f740f 4.xxx.203.xx
> 66.55.xxx.100 03/18/07 19:09:41
>
> now there would be several lines like this.
>
> i want to put it into a form text area and submit it.
>
> on the asp page, i want it to put a | between each item on each line, but
> NOT after the last item on each line.
>
> so the output would look like this.
> ex
>
> someplayername | 1bff911a47a2e3044c5f4f6a27d68533 | 4.xxx.203.xx |
> 212.xxx.208.195 | 03/18/07 19:36:41
> someplayername2 | 1930ca7a22e0985c4241b859a06f740f | 4.xxx.203.xx |
> 66.55.xxx.100 | 03/18/07 19:09:41
>
> i know you will ask why. this is the format for my vbulleten forum to make
> a table.
> now sometimes, there is more than one space between objects there. so i
> would want to be able to take out the extra spaces so it would be like
>
> someplayername | 1bff911a47a2e3044c5f4f6a27d68533 | 4.xxx.203.xx |
> 212.xxx.208.195 | 03/18/07 19:36:41
> someplayername2 | 1930ca7a22e0985c4241b859a06f740f | 4.xxx.203.xx |
> 66.55.xxx.100 | 03/18/07 19:09:41
>
> now if removing the spaces is a big deal, then i won't care to do it.
>
> but the question i have is basically how to do this.
>
> i could replace "" with |, but then it would replace every space right?
> I only need one space between replaced.
>
> Hope I am not confusing folks out there.
>
> If anyone can help, I would appreciate it
> TIA
>
> Bam
by the way.... it looped here, the lines should look like this with no wrap
"Bam" wrote in message
news:47f1a073$0$6140$4c368faf@roadrunner.com...
> Not sure how the title should have been, but here goes
>
> I want to take txt that i copy from a table on a site
>
> ex
>
> someplayername 1bff911a47a2e3044c5f4f6a27d68533 4.xxx.203.xx
> 212.xxx.208.195 03/18/07 19:36:41
> someplayername2 1930ca7a22e0985c4241b859a06f740f 4.xxx.203.xx
> 66.55.xxx.100 03/18/07 19:09:41
>
> now there would be several lines like this.
>
> i want to put it into a form text area and submit it.
>
> on the asp page, i want it to put a | between each item on each line, but
> NOT after the last item on each line.
>
> so the output would look like this.
> ex
>
> someplayername | 1bff911a47a2e3044c5f4f6a27d68533 | 4.xxx.203.xx |
> 212.xxx.208.195 | 03/18/07 19:36:41
> someplayername2 | 1930ca7a22e0985c4241b859a06f740f | 4.xxx.203.xx |
> 66.55.xxx.100 | 03/18/07 19:09:41
>
> i know you will ask why. this is the format for my vbulleten forum to make
a
> table.
> now sometimes, there is more than one space between objects there. so i
> would want to be able to take out the extra spaces so it would be like
>
> someplayername | 1bff911a47a2e3044c5f4f6a27d68533 | 4.xxx.203.xx |
> 212.xxx.208.195 | 03/18/07 19:36:41
> someplayername2 | 1930ca7a22e0985c4241b859a06f740f | 4.xxx.203.xx |
> 66.55.xxx.100 | 03/18/07 19:09:41
>
> now if removing the spaces is a big deal, then i won't care to do it.
>
> but the question i have is basically how to do this.
>
> i could replace "" with |, but then it would replace every space right?
> I only need one space between replaced.
>
> Hope I am not confusing folks out there.
>
> If anyone can help, I would appreciate it
Its not entirely clear whether you need to do this clientside or serverside.
Since you're posting to this ASP group I'll assume serverside and I'll
assume the script language you are using is VBScript. Slap this in a
test.asp and visit it:-
<%
Function NewRegExp(rsPattern, rbGlobal, rbCaseInsensitive)
Set NewRegExp = new RegExp
NewRegExp.Pattern = rsPattern
NewRegExp.Global = rbGlobal
NewRegExp.IgnoreCase = rbCaseInsensitive
End Function
Dim sIn: sIn = " someplayername 1bff911a47a2e3044c5f4f6a27d68533
4.xxx.203.xx 212.xxx.208.195 03/18/07 19:36:41 "
The code doesn't care how many spaces delimit each field the result is
consistent.
--
Anthony Jones - MVP ASP/ASP.NET
Re: replacing a space or something like that
am 01.04.2008 15:45:51 von Daniel Crichton
Bam wrote on Tue, 1 Apr 2008 08:49:11 -0500:
> "Anthony Jones" wrote in message news:ebnvHT9kIHA.5160@TK2MSFTNGP05.phx.gbl...
>> "Bam" wrote in message
>> news:47f1a073$0$6140$4c368faf@roadrunner.com...
>>> Not sure how the title should have been, but here goes
>>> I want to take txt that i copy from a table on a site
>>> i know you will ask why. this is the format for my vbulleten forum
>>> to make
>> a
>>> table.
>>> now sometimes, there is more than one space between objects there.
>>> so i would want to be able to take out the extra spaces so it would
>>> be like
>>> now if removing the spaces is a big deal, then i won't care to do
>>> it.
>>> but the question i have is basically how to do this.
>>> i could replace "" with |, but then it would replace every space
>>> right?
>>> I only need one space between replaced.
>>> Hope I am not confusing folks out there.
>>> If anyone can help, I would appreciate it
>> Its not entirely clear whether you need to do this clientside or
>> serverside.
>> Since you're posting to this ASP group I'll assume serverside and
>> I'll assume the script language you are using is VBScript. Slap this
>> in a test.asp and visit it:-
>> <%
>> Function NewRegExp(rsPattern, rbGlobal, rbCaseInsensitive)
>> Set NewRegExp = new RegExp
>> NewRegExp.Pattern = rsPattern
>> NewRegExp.Global = rbGlobal
>> NewRegExp.IgnoreCase = rbCaseInsensitive
>> End Function
>> Dim sIn: sIn = " someplayername 1bff911a47a2e3044c5f4f6a27d68533
>> 4.xxx.203.xx 212.xxx.208.195 03/18/07 19:36:41 "
> when I try multiple lines, it returns only 1 line, and merges the two
> together.
> like this someplayername | 1bff911a47a2e3044c5f4f6a27d68533 |
> 4.xxx.203.xx | 212.xxx.208.195 | 03/18/07 19:36:41| someplayername2 |
> 1930ca7a22e0985c4241b859a06f740f | 4.xxx.203.xx | 66.55.xxx.100 |
> 03/18/07 19:09:41
> If multiple lines are entered into the txt field, i need it to show
> multiple lines.
When you say "lines", what character is splitting the lines up?
I'm not familiar with regular expressions, so I can only guess that either
\s+ replaces all spaces and line breaks, or your "line breaks" are actually
just spaces.
Because of the space in the time it's not as simple as it might seem at
first, if you can guarantee that there will always be two spaces between
"columns" and a proper line break (CR+LF or LF) it would be simple to use
the Replace function:
sNewData = Replace(sData," "," | ")
--
Dan
Re: replacing a space or something like that
am 01.04.2008 15:49:11 von Bam
"Anthony Jones" wrote in message
news:ebnvHT9kIHA.5160@TK2MSFTNGP05.phx.gbl...
> "Bam" wrote in message
> news:47f1a073$0$6140$4c368faf@roadrunner.com...
>> Not sure how the title should have been, but here goes
>>
>> I want to take txt that i copy from a table on a site
>>
>> ex
>>
>> someplayername 1bff911a47a2e3044c5f4f6a27d68533 4.xxx.203.xx
>> 212.xxx.208.195 03/18/07 19:36:41
>> someplayername2 1930ca7a22e0985c4241b859a06f740f 4.xxx.203.xx
>> 66.55.xxx.100 03/18/07 19:09:41
>>
>> now there would be several lines like this.
>>
>> i want to put it into a form text area and submit it.
>>
>> on the asp page, i want it to put a | between each item on each line, but
>> NOT after the last item on each line.
>>
>> so the output would look like this.
>> ex
>>
>> someplayername | 1bff911a47a2e3044c5f4f6a27d68533 | 4.xxx.203.xx |
>> 212.xxx.208.195 | 03/18/07 19:36:41
>> someplayername2 | 1930ca7a22e0985c4241b859a06f740f | 4.xxx.203.xx |
>> 66.55.xxx.100 | 03/18/07 19:09:41
>>
>> i know you will ask why. this is the format for my vbulleten forum to
>> make
> a
>> table.
>> now sometimes, there is more than one space between objects there. so i
>> would want to be able to take out the extra spaces so it would be like
>>
>> someplayername | 1bff911a47a2e3044c5f4f6a27d68533 | 4.xxx.203.xx |
>> 212.xxx.208.195 | 03/18/07 19:36:41
>> someplayername2 | 1930ca7a22e0985c4241b859a06f740f | 4.xxx.203.xx |
>> 66.55.xxx.100 | 03/18/07 19:09:41
>>
>> now if removing the spaces is a big deal, then i won't care to do it.
>>
>> but the question i have is basically how to do this.
>>
>> i could replace "" with |, but then it would replace every space right?
>> I only need one space between replaced.
>>
>> Hope I am not confusing folks out there.
>>
>> If anyone can help, I would appreciate it
>
> Its not entirely clear whether you need to do this clientside or
> serverside.
> Since you're posting to this ASP group I'll assume serverside and I'll
> assume the script language you are using is VBScript. Slap this in a
> test.asp and visit it:-
>
> <%
> Function NewRegExp(rsPattern, rbGlobal, rbCaseInsensitive)
>
> Set NewRegExp = new RegExp
> NewRegExp.Pattern = rsPattern
> NewRegExp.Global = rbGlobal
> NewRegExp.IgnoreCase = rbCaseInsensitive
>
> End Function
>
> Dim sIn: sIn = " someplayername 1bff911a47a2e3044c5f4f6a27d68533
> 4.xxx.203.xx 212.xxx.208.195 03/18/07 19:36:41 "
>
> Response.Write NewRegExp("\s+", true, false).Replace(Trim(sIn), " | ")
>
> %>
>
> The code doesn't care how many spaces delimit each field the result is
> consistent.
>
>
>
> --
> Anthony Jones - MVP ASP/ASP.NET
>
That works if there is only one line in the txt field
when I try multiple lines, it returns only 1 line, and merges the two
together.
like this
someplayername | 1bff911a47a2e3044c5f4f6a27d68533 | 4.xxx.203.xx |
212.xxx.208.195 | 03/18/07 19:36:41| someplayername2 |
1930ca7a22e0985c4241b859a06f740f | 4.xxx.203.xx | 66.55.xxx.100 | 03/18/07
19:09:41
If multiple lines are entered into the txt field, i need it to show multiple
lines.
Re: replacing a space or something like that
am 01.04.2008 17:06:57 von Bam
>> "Anthony Jones" wrote in message
>> news:ebnvHT9kIHA.5160@TK2MSFTNGP05.phx.gbl...
> >> "Bam" wrote in message
> >> news:47f1a073$0$6140$4c368faf@roadrunner.com...
> >>> Not sure how the title should have been, but here goes
>
> >>> I want to take txt that i copy from a table on a site
>
> >>> ex
>
> >>> someplayername 1bff911a47a2e3044c5f4f6a27d68533 4.xxx.203.xx
> >>> 212.xxx.208.195 03/18/07 19:36:41 someplayername2
> >>> 1930ca7a22e0985c4241b859a06f740f 4.xxx.203.xx 66.55.xxx.100
> >>> 03/18/07 19:09:41
>
> >>> now there would be several lines like this.
>
> >>> i want to put it into a form text area and submit it.
>
> >>> on the asp page, i want it to put a | between each item on each
> >>> line, but
> >>> NOT after the last item on each line.
>
> >>> so the output would look like this.
> >>> ex
>
> >>> someplayername | 1bff911a47a2e3044c5f4f6a27d68533 | 4.xxx.203.xx
> >>> |
> >>> 212.xxx.208.195 | 03/18/07 19:36:41 someplayername2 |
> >>> 1930ca7a22e0985c4241b859a06f740f | 4.xxx.203.xx |
> >>> 66.55.xxx.100 | 03/18/07 19:09:41
>
> >>> i know you will ask why. this is the format for my vbulleten forum
> >>> to make
> >> a
> >>> table.
> >>> now sometimes, there is more than one space between objects there.
> >>> so i would want to be able to take out the extra spaces so it would
> >>> be like
>
> >>> someplayername | 1bff911a47a2e3044c5f4f6a27d68533 | 4.xxx.203.xx |
> >>> 212.xxx.208.195 | 03/18/07 19:36:41 someplayername2 |
> >>> 1930ca7a22e0985c4241b859a06f740f | 4.xxx.203.xx |
> >>> 66.55.xxx.100 | 03/18/07 19:09:41
>
> >>> now if removing the spaces is a big deal, then i won't care to do
> >>> it.
>
> >>> but the question i have is basically how to do this.
>
> >>> i could replace "" with |, but then it would replace every space
> >>> right?
> >>> I only need one space between replaced.
>
> >>> Hope I am not confusing folks out there.
>
> >>> If anyone can help, I would appreciate it
>
> >> Its not entirely clear whether you need to do this clientside or
> >> serverside.
> >> Since you're posting to this ASP group I'll assume serverside and
> >> I'll assume the script language you are using is VBScript. Slap this
> >> in a test.asp and visit it:-
>
> >> <%
> >> Function NewRegExp(rsPattern, rbGlobal, rbCaseInsensitive)
>
> >> Set NewRegExp = new RegExp
> >> NewRegExp.Pattern = rsPattern
> >> NewRegExp.Global = rbGlobal
> >> NewRegExp.IgnoreCase = rbCaseInsensitive
>
> >> End Function
>
> >> Dim sIn: sIn = " someplayername 1bff911a47a2e3044c5f4f6a27d68533
> >> 4.xxx.203.xx 212.xxx.208.195 03/18/07 19:36:41 "
>
> >> Response.Write NewRegExp("\s+", true, false).Replace(Trim(sIn), " |
> >> ")
>
> >> %>
>
> >> The code doesn't care how many spaces delimit each field the result
> >> is consistent.
>
>
>
> >> --
> >> Anthony Jones - MVP ASP/ASP.NET
>
>
>> That works if there is only one line in the txt field
>
>> But there can be as many as 20 lines
>
>> someplayername | 1bff911a47a2e3044c5f4f6a27d68533 | 4.xxx.203.xx |
>> 212.xxx.208.195 | 03/18/07 19:36:41 someplayername2 |
>> 1930ca7a22e0985c4241b859a06f740f | 4.xxx.203.xx | 66.55.xxx.100 |
>> 03/18/07 19:09:41
>
>> when I try multiple lines, it returns only 1 line, and merges the two
>> together.
>> like this someplayername | 1bff911a47a2e3044c5f4f6a27d68533 |
>> 4.xxx.203.xx | 212.xxx.208.195 | 03/18/07 19:36:41| someplayername2 |
>> 1930ca7a22e0985c4241b859a06f740f | 4.xxx.203.xx | 66.55.xxx.100 |
>> 03/18/07 19:09:41
>
>> If multiple lines are entered into the txt field, i need it to show
>> multiple lines.
>
>
> When you say "lines", what character is splitting the lines up?
>
> I'm not familiar with regular expressions, so I can only guess that either
> \s+ replaces all spaces and line breaks, or your "line breaks" are
> actually just spaces.
>
> Because of the space in the time it's not as simple as it might seem at
> first, if you can guarantee that there will always be two spaces between
> "columns" and a proper line break (CR+LF or LF) it would be simple to use
> the Replace function:
>
> sNewData = Replace(sData," "," | ")
>
> --
> Dan
since the lines are just copied from a table on another site, i can't be
sure that it would have 2 spaces.
is there a way i can say add each line separatly? make a form with say 20
fields. and enter a line for each one.
then on the asp page do a
for each or something. hmmm.. just thinking out loud here
Re: replacing a space or something like that
am 01.04.2008 22:08:18 von Anthony Jones
"Bam" wrote in message
news:47f2405b$0$6473$4c368faf@roadrunner.com...
> >> "Anthony Jones" wrote in message
> >> news:ebnvHT9kIHA.5160@TK2MSFTNGP05.phx.gbl...
> > >> "Bam" wrote in message
> > >> news:47f1a073$0$6140$4c368faf@roadrunner.com...
> > >>> Not sure how the title should have been, but here goes
> >
> > >>> I want to take txt that i copy from a table on a site
> >
> > >>> ex
> >
> > >>> someplayername 1bff911a47a2e3044c5f4f6a27d68533 4.xxx.203.xx
> > >>> 212.xxx.208.195 03/18/07 19:36:41 someplayername2
> > >>> 1930ca7a22e0985c4241b859a06f740f 4.xxx.203.xx 66.55.xxx.100
> > >>> 03/18/07 19:09:41
> >
> > >>> now there would be several lines like this.
> >
> > >>> i want to put it into a form text area and submit it.
> >
> > >>> on the asp page, i want it to put a | between each item on each
> > >>> line, but
> > >>> NOT after the last item on each line.
> >
> > >>> so the output would look like this.
> > >>> ex
> >
> > >>> someplayername | 1bff911a47a2e3044c5f4f6a27d68533 | 4.xxx.203.xx
> > >>> |
> > >>> 212.xxx.208.195 | 03/18/07 19:36:41 someplayername2 |
> > >>> 1930ca7a22e0985c4241b859a06f740f | 4.xxx.203.xx |
> > >>> 66.55.xxx.100 | 03/18/07 19:09:41
> >
> > >>> i know you will ask why. this is the format for my vbulleten forum
> > >>> to make
> > >> a
> > >>> table.
> > >>> now sometimes, there is more than one space between objects there.
> > >>> so i would want to be able to take out the extra spaces so it would
> > >>> be like
> >
> > >>> someplayername | 1bff911a47a2e3044c5f4f6a27d68533 | 4.xxx.203.xx |
> > >>> 212.xxx.208.195 | 03/18/07 19:36:41 someplayername2 |
> > >>> 1930ca7a22e0985c4241b859a06f740f | 4.xxx.203.xx |
> > >>> 66.55.xxx.100 | 03/18/07 19:09:41
> >
> > >>> now if removing the spaces is a big deal, then i won't care to do
> > >>> it.
> >
> > >>> but the question i have is basically how to do this.
> >
> > >>> i could replace "" with |, but then it would replace every space
> > >>> right?
> > >>> I only need one space between replaced.
> >
> > >>> Hope I am not confusing folks out there.
> >
> > >>> If anyone can help, I would appreciate it
> >
> > >> Its not entirely clear whether you need to do this clientside or
> > >> serverside.
> > >> Since you're posting to this ASP group I'll assume serverside and
> > >> I'll assume the script language you are using is VBScript. Slap this
> > >> in a test.asp and visit it:-
> >
> > >> <%
> > >> Function NewRegExp(rsPattern, rbGlobal, rbCaseInsensitive)
> >
> > >> Set NewRegExp = new RegExp
> > >> NewRegExp.Pattern = rsPattern
> > >> NewRegExp.Global = rbGlobal
> > >> NewRegExp.IgnoreCase = rbCaseInsensitive
> >
> > >> End Function
> >
> > >> Dim sIn: sIn = " someplayername 1bff911a47a2e3044c5f4f6a27d68533
> > >> 4.xxx.203.xx 212.xxx.208.195 03/18/07 19:36:41 "
> >
> > >> Response.Write NewRegExp("\s+", true, false).Replace(Trim(sIn), " |
> > >> ")
> >
> > >> %>
> >
> > >> The code doesn't care how many spaces delimit each field the result
> > >> is consistent.
> >
> >
> >
> > >> --
> > >> Anthony Jones - MVP ASP/ASP.NET
> >
> >
> >> That works if there is only one line in the txt field
> >
> >> But there can be as many as 20 lines
> >
> >> someplayername | 1bff911a47a2e3044c5f4f6a27d68533 | 4.xxx.203.xx |
> >> 212.xxx.208.195 | 03/18/07 19:36:41 someplayername2 |
> >> 1930ca7a22e0985c4241b859a06f740f | 4.xxx.203.xx | 66.55.xxx.100 |
> >> 03/18/07 19:09:41
> >
> >> when I try multiple lines, it returns only 1 line, and merges the two
> >> together.
> >> like this someplayername | 1bff911a47a2e3044c5f4f6a27d68533 |
> >> 4.xxx.203.xx | 212.xxx.208.195 | 03/18/07 19:36:41| someplayername2 |
> >> 1930ca7a22e0985c4241b859a06f740f | 4.xxx.203.xx | 66.55.xxx.100 |
> >> 03/18/07 19:09:41
> >
> >> If multiple lines are entered into the txt field, i need it to show
> >> multiple lines.
> >
> >
> > When you say "lines", what character is splitting the lines up?
> >
> > I'm not familiar with regular expressions, so I can only guess that
either
> > \s+ replaces all spaces and line breaks, or your "line breaks" are
> > actually just spaces.
> >
> > Because of the space in the time it's not as simple as it might seem at
> > first, if you can guarantee that there will always be two spaces between
> > "columns" and a proper line break (CR+LF or LF) it would be simple to
use
> > the Replace function:
> >
> > sNewData = Replace(sData," "," | ")
> >
> > --
> > Dan
> since the lines are just copied from a table on another site, i can't be
> sure that it would have 2 spaces.
>
> is there a way i can say add each line separatly? make a form with say 20
> fields. and enter a line for each one.
>
> then on the asp page do a
> for each or something. hmmm.. just thinking out loud here
>
>
Given a string containing multiple lines this would probably work:-
Dim asLines : asLines = Split(sData, vbCrLf)
Dim rgx : Set rgx = NewRegExp("\s+", true, false)
Dim i
For i = 0 To UBound(asLines)
asLines(i) = rgx.Replace(asLines(i), " | ")
Next
sNewData = Join(asLines, vbCrLf)
It may be that the input lines aren't delimited by CR LF but just LF in that
case use vbLf in the split instead.
--
Anthony Jones - MVP ASP/ASP.NET
Re: replacing a space or something like that
am 03.04.2008 06:10:38 von Bam
> Given a string containing multiple lines this would probably work:-
>
> Dim asLines : asLines = Split(sData, vbCrLf)
> Dim rgx : Set rgx = NewRegExp("\s+", true, false)
> Dim i
> For i = 0 To UBound(asLines)
> asLines(i) = rgx.Replace(asLines(i), " | ")
> Next
>
> sNewData = Join(asLines, vbCrLf)
>
>
> It may be that the input lines aren't delimited by CR LF but just LF in
> that
> case use vbLf in the split instead.
>
a bit confused here. would that be used in place of
Function NewRegExp(rsPattern, rbGlobal, rbCaseInsensitive)
Set NewRegExp = new RegExp
NewRegExp.Pattern = rsPattern
NewRegExp.Global = rbGlobal
NewRegExp.IgnoreCase = rbCaseInsensitive
End Function
or to be used along with it
and thanks again for the response.
Re: replacing a space or something like that
am 03.04.2008 23:42:42 von Anthony Jones
"Bam" wrote in message
news:47f449a7$0$17342$4c368faf@roadrunner.com...
>
>
> > Given a string containing multiple lines this would probably work:-
> >
> > Dim asLines : asLines = Split(sData, vbCrLf)
> > Dim rgx : Set rgx = NewRegExp("\s+", true, false)
> > Dim i
> > For i = 0 To UBound(asLines)
> > asLines(i) = rgx.Replace(asLines(i), " | ")
> > Next
> >
> > sNewData = Join(asLines, vbCrLf)
> >
> >
> > It may be that the input lines aren't delimited by CR LF but just LF in
> > that
> > case use vbLf in the split instead.
> >
> a bit confused here. would that be used in place of
> Function NewRegExp(rsPattern, rbGlobal, rbCaseInsensitive)
>
> Set NewRegExp = new RegExp
> NewRegExp.Pattern = rsPattern
> NewRegExp.Global = rbGlobal
> NewRegExp.IgnoreCase = rbCaseInsensitive
>
> End Function
>
> or to be used along with it
>
> and thanks again for the response.
>
The NewRegExp function would need to be used with the code I posted. I
didn't include it my subsequent post because it had not changed.
--
Anthony Jones - MVP ASP/ASP.NET
Re: replacing a space or something like that
am 04.04.2008 04:39:44 von Bam
>> >
>> a bit confused here. would that be used in place of
>> Function NewRegExp(rsPattern, rbGlobal, rbCaseInsensitive)
>>
>> Set NewRegExp = new RegExp
>> NewRegExp.Pattern = rsPattern
>> NewRegExp.Global = rbGlobal
>> NewRegExp.IgnoreCase = rbCaseInsensitive
>>
>> End Function
>>
>> or to be used along with it
>>
>> and thanks again for the response.
>>
>
> The NewRegExp function would need to be used with the code I posted. I
> didn't include it my subsequent post because it had not changed.
>
> --
> Anthony Jones - MVP ASP/ASP.NET
>
>
>
>
ok, so the code should be
rsTEXT = request.form("txtInput")
Function NewRegExp(rsPattern, rbGlobal, rbCaseInsensitive)
Set NewRegExp = new RegExp
NewRegExp.Pattern = rsPattern
NewRegExp.Global = rbGlobal
NewRegExp.IgnoreCase = rbCaseInsensitive
End Function
Dim sIn: sIn = rsTEXT
Dim asLines : asLines = Split(sData, vbCrLf)
Dim rgx : Set rgx = NewRegExp("\s+", true, false)
Dim i
For i = 0 To UBound(asLines)
asLines(i) = rgx.Replace(asLines(i), " | ")
Next
> ok, so the code should be
>
> rsTEXT = request.form("txtInput")
>
> Function NewRegExp(rsPattern, rbGlobal, rbCaseInsensitive)
>
> Set NewRegExp = new RegExp
> NewRegExp.Pattern = rsPattern
> NewRegExp.Global = rbGlobal
> NewRegExp.IgnoreCase = rbCaseInsensitive
>
> End Function
>
> Dim sIn: sIn = rsTEXT
>
>
> Dim asLines : asLines = Split(sData, vbCrLf)
> Dim rgx : Set rgx = NewRegExp("\s+", true, false)
> Dim i
> For i = 0 To UBound(asLines)
> asLines(i) = rgx.Replace(asLines(i), " | ")
> Next
>
> sNewData = Join(asLines, vbCrLf)
>
> now to display it... would i use
>
> Response.Write NewRegExp("\s+", true, false).Replace(Trim(sIn), " | ")
> or
> Response.Write sNewData("\s+", true, false).Replace(Trim(sIn), " | ")
>
>
ok, sortof got it to work. The only problem is, it is joining the lines
together. when
paxtyr=) ab96c5938eff012c6e67e49c6b3ddc90 xxx.xxx.xxx.xxx yyy.yyy.yyy.yyy
04/01/08 15:23:22
paxtyr=) ab96c5938eff012c6e67e49c6b3ddc90 xxx.xxx.xxx.xxx yyy.yyy.yyy.yyy
04/01/08 15:00:05
paxtyr=) ab96c5938eff012c6e67e49c6b3ddc90 xxx.xxx.xxx.xxx yyy.yyy.yyy.yyy
03/30/08 11:34:20
"Bam" wrote in message
news:47f585a8$0$1091$4c368faf@roadrunner.com...
> >> >
> >> a bit confused here. would that be used in place of
> >> Function NewRegExp(rsPattern, rbGlobal, rbCaseInsensitive)
> >>
> >> Set NewRegExp = new RegExp
> >> NewRegExp.Pattern = rsPattern
> >> NewRegExp.Global = rbGlobal
> >> NewRegExp.IgnoreCase = rbCaseInsensitive
> >>
> >> End Function
> >>
> >> or to be used along with it
> >>
> >> and thanks again for the response.
> >>
> >
> > The NewRegExp function would need to be used with the code I posted. I
> > didn't include it my subsequent post because it had not changed.
> >
> > --
> > Anthony Jones - MVP ASP/ASP.NET
> >
> >
> >
> >
>
> ok, so the code should be
>
> rsTEXT = request.form("txtInput")
>
> Function NewRegExp(rsPattern, rbGlobal, rbCaseInsensitive)
>
> Set NewRegExp = new RegExp
> NewRegExp.Pattern = rsPattern
> NewRegExp.Global = rbGlobal
> NewRegExp.IgnoreCase = rbCaseInsensitive
>
> End Function
>
> Dim sIn: sIn = rsTEXT
>
>
> Dim asLines : asLines = Split(sData, vbCrLf)
> Dim rgx : Set rgx = NewRegExp("\s+", true, false)
> Dim i
> For i = 0 To UBound(asLines)
> asLines(i) = rgx.Replace(asLines(i), " | ")
> Next
>
> sNewData = Join(asLines, vbCrLf)
>
> now to display it... would i use
>
I think you've confused code I've posted with code posted by others.
These are incorrect. The variable sNewData would now contain what you need.
Response.Write sNewData
Note the assumption is that the lines are delimited with CR LF. It is
possible to receive lines seperated with just LF in which case you would
need to change the Split to Split(sData, vbLf).
--
Anthony Jones - MVP ASP/ASP.NET
Re: replacing a space or something like that
am 04.04.2008 09:01:18 von Anthony Jones
"Bam" wrote in message
news:47f5accb$0$17333$4c368faf@roadrunner.com...
> > ok, so the code should be
> >
> > rsTEXT = request.form("txtInput")
> >
> > Function NewRegExp(rsPattern, rbGlobal, rbCaseInsensitive)
> >
> > Set NewRegExp = new RegExp
> > NewRegExp.Pattern = rsPattern
> > NewRegExp.Global = rbGlobal
> > NewRegExp.IgnoreCase = rbCaseInsensitive
> >
> > End Function
> >
> > Dim sIn: sIn = rsTEXT
> >
> >
> > Dim asLines : asLines = Split(sData, vbCrLf)
> > Dim rgx : Set rgx = NewRegExp("\s+", true, false)
> > Dim i
> > For i = 0 To UBound(asLines)
> > asLines(i) = rgx.Replace(asLines(i), " | ")
> > Next
> >
> > sNewData = Join(asLines, vbCrLf)
> >
> > now to display it... would i use
> >
> > Response.Write NewRegExp("\s+", true, false).Replace(Trim(sIn), " | ")
> > or
> > Response.Write sNewData("\s+", true, false).Replace(Trim(sIn), " | ")
> >
> >
>
> ok, sortof got it to work. The only problem is, it is joining the lines
> together. when
> paxtyr=) ab96c5938eff012c6e67e49c6b3ddc90 xxx.xxx.xxx.xxx yyy.yyy.yyy.yyy
> 04/01/08 15:23:22
> paxtyr=) ab96c5938eff012c6e67e49c6b3ddc90 xxx.xxx.xxx.xxx yyy.yyy.yyy.yyy
> 04/01/08 15:00:05
> paxtyr=) ab96c5938eff012c6e67e49c6b3ddc90 xxx.xxx.xxx.xxx yyy.yyy.yyy.yyy
> 03/30/08 11:34:20
>
> is entered, it looks like this on the output
>
> paxtyr=) | ab96c5938eff012c6e67e49c6b3ddc90 | xxx.xxx.xxx.xxx |
> yyy.yyy.yyy.yyy | 04/01/08 | 15:23:22 | paxtyr=) |
> ab96c5938eff012c6e67e49c6b3ddc90 xxx.xxx.xxx.xxx | yyy.yyy.yyy.yyy |
> 04/01/08 | 15:00:05 | paxtyr=) | ab96c5938eff012c6e67e49c6b3ddc90 |
> xxx.xxx.xxx.xxx | yyy.yyy.yyy.yyy | 03/30/08 | 11:34:20
>
> I still need the lines to be seperate, but have the | in the correct
places
> like this
>
> paxtyr=) | ab96c5938eff012c6e67e49c6b3ddc90 | xxx.xxx.xxx.xxx |
> yyy.yyy.yyy.yyy | 04/01/08 | 15:23:22
> paxtyr=) | ab96c5938eff012c6e67e49c6b3ddc90 | xxx.xxx.xxx.xxx |
> yyy.yyy.yyy.yyy | 04/01/08 | 15:00:05
> paxtyr=) | ab96c5938eff012c6e67e49c6b3ddc90 | xxx.xxx.xxx.xxx |
> yyy.yyy.yyy.yyy | 03/30/08 | 11:34:20
>
> does it help if i say the lines are seperated by
>
You have two choices either you can change the Join to:-
sNewData = Join(asLines, " ")
which would display correctly in HTML but would mean that sNewData would not
be meaningful to something which is expected standard text.
OR
you could leave the join as it is and use the following code when sending to
the browser:-
Response.Write Replace(sNewData, vbCrLf, " ")
--
Anthony Jones - MVP ASP/ASP.NET
Re: replacing a space or something like that
am 04.04.2008 20:13:00 von Bam
> I think you've confused code I've posted with code posted by others.
>
>> Response.Write NewRegExp("\s+", true, false).Replace(Trim(sIn), " | ")
>> or
>> Response.Write sNewData("\s+", true, false).Replace(Trim(sIn), " | ")
>
> These are incorrect. The variable sNewData would now contain what you
> need.
>
> Response.Write sNewData
>
> Note the assumption is that the lines are delimited with CR LF. It is
> possible to receive lines seperated with just LF in which case you would
> need to change the Split to Split(sData, vbLf).
>
>
> --
> Anthony Jones - MVP ASP/ASP.NET
ok, here is the code i have
<%
rsTEXT = request.form("frmTEXT")
Function sNewData(rsPattern, rbGlobal, rbCaseInsensitive)
Set sNewData = new RegExp
sNewData.Pattern = rsPattern
sNewData.Global = rbGlobal
sNewData.IgnoreCase = rbCaseInsensitive
End Function
Dim sIn: sIn = rsTEXT
Dim asLines : asLines = Split(sData, vbCrLf)
Dim rgx : Set rgx = sNewData("\s+", true, false)
Dim i
For i = 0 To UBound(asLines)
asLines(i) = rgx.Replace(asLines(i), " | ")
Next
I have checked, and the data is passing from the form to this page.
Re: replacing a space or something like that
am 04.04.2008 21:35:05 von exjxw.hannivoort
Bam wrote on 04 apr 2008 in microsoft.public.inetserver.asp.general:
>
>
>> I think you've confused code I've posted with code posted by others.
>>
>>> Response.Write NewRegExp("\s+", true, false).Replace(Trim(sIn), " |
")
>>> or
>>> Response.Write sNewData("\s+", true, false).Replace(Trim(sIn), " | ")
>>
>> These are incorrect. The variable sNewData would now contain what you
>> need.
>>
>> Response.Write sNewData
>>
>> Note the assumption is that the lines are delimited with CR LF. It is
>> possible to receive lines seperated with just LF in which case you
would
>> need to change the Split to Split(sData, vbLf).
>>
>>
>> --
>> Anthony Jones - MVP ASP/ASP.NET
>
>
> ok, here is the code i have
>
> <%
>
> rsTEXT = request.form("frmTEXT")
>
> Function sNewData(rsPattern, rbGlobal, rbCaseInsensitive)
>
> Set sNewData = new RegExp
> sNewData.Pattern = rsPattern
> sNewData.Global = rbGlobal
> sNewData.IgnoreCase = rbCaseInsensitive
>
> End Function
>
> Dim sIn: sIn = rsTEXT
>
>
> Dim asLines : asLines = Split(sData, vbCrLf)
You have not assigned any value to sData.
try:
asLines = Split(rsTEXT, vbCrLf)
> Dim rgx : Set rgx = sNewData("\s+", true, false)
> Dim i
> For i = 0 To UBound(asLines)
> asLines(i) = rgx.Replace(asLines(i), " | ")
> Next
>
> sNewData = Join(asLines, vbCrLf) <---- line 348
>
> 'new_txt = sNewData("\s+", true, false).Replace(Trim(sIn), " | ")
>
> Response.Write sNewData
>
> %>
> i am getting the following error
>
> Microsoft VBScript runtime error '800a01f5'
>
> Illegal assignment: 'sNewData'
>
> /table_creator3.asp, line 348
>
try this, forgetting the Dim statements:
================================================
<%
t = "hi 0 hi" & vbCrLf & "there there"
arr = Split(t, vbCrLf)
set rgx = sNewData( "\s+", true, false )
For i = 0 To UBound(arr)
arr(i) = rgx.Replace(arr(i), " | ")
Next
r = Join(arr, vbCrLf)
Response.Write r
Function sNewData(rsPattern, rbGlobal, rbCaseInsensitive)
set sNewData = new RegExp
sNewData.Pattern = rsPattern
sNewData.Global = rbGlobal
sNewData.IgnoreCase = rbCaseInsensitive
End Function
%>
================================================
However why not use some jscript?
================================================
<%
t = "hi 0 hi" & vbCrLf & "there there"
r = rgxReplaceGlob(t, " | ")
Response.Write r
%>
================================================
my
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Re: replacing a space or something like that
am 04.04.2008 22:07:47 von Anthony Jones
"Bam" wrote in message
news:47f6606d$0$16673$4c368faf@roadrunner.com...
>
>
> > I think you've confused code I've posted with code posted by others.
> >
> >> Response.Write NewRegExp("\s+", true, false).Replace(Trim(sIn), " | ")
> >> or
> >> Response.Write sNewData("\s+", true, false).Replace(Trim(sIn), " | ")
> >
> > These are incorrect. The variable sNewData would now contain what you
> > need.
> >
> > Response.Write sNewData
> >
> > Note the assumption is that the lines are delimited with CR LF. It is
> > possible to receive lines seperated with just LF in which case you would
> > need to change the Split to Split(sData, vbLf).
> >
> >
> > --
> > Anthony Jones - MVP ASP/ASP.NET
>
>
> ok, here is the code i have
>
> <%
>
> rsTEXT = request.form("frmTEXT")
>
> Function sNewData(rsPattern, rbGlobal, rbCaseInsensitive)
>
> Set sNewData = new RegExp
> sNewData.Pattern = rsPattern
> sNewData.Global = rbGlobal
> sNewData.IgnoreCase = rbCaseInsensitive
>
> End Function
>
> Dim sIn: sIn = rsTEXT
>
>
> Dim asLines : asLines = Split(sData, vbCrLf)
> Dim rgx : Set rgx = sNewData("\s+", true, false)
> Dim i
> For i = 0 To UBound(asLines)
> asLines(i) = rgx.Replace(asLines(i), " | ")
> Next
>
> sNewData = Join(asLines, vbCrLf) <---- line 348
>
> 'new_txt = sNewData("\s+", true, false).Replace(Trim(sIn), " | ")
>
> Response.Write sNewData
>
> %>
> i am getting the following error
>
> Microsoft VBScript runtime error '800a01f5'
>
> Illegal assignment: 'sNewData'
>
> /table_creator3.asp, line 348
>
Here is a complete tested ASP page, copy it into a blank ASP page verbatim.
Enter the data from your original post into the top text area and click Go.
The lower textarea shows you the exact string that has been generated using
| delimiters and the div shows you how to display it as HTML.
<%
Option Explicit
Dim msTextIn : msTextIn = Request.Form("txtInput")
Dim msTextOut : msTextOut = ""
If msTextIn <> "" Then
msTextOut = PipeDelimit(msTextIn)
End If
Function PipeDelimit(rsIn)
Dim asLines : asLines = Split(rsIn, vbCrLf)
Dim rgx : Set rgx = NewRegExp("\s+", true, false)
Dim i
For i = 0 To UBound(asLines)
asLines(i) = rgx.Replace(Trim(asLines(i)), " | ")
Next
PipeDelimit = Join(asLines, vbCrLf)
End Function
%>
Test Formatting
Re: replacing a space or something like that
am 04.04.2008 23:40:16 von Bam
> Here is a complete tested ASP page, copy it into a blank ASP page
> verbatim.
>
> Enter the data from your original post into the top text area and click
> Go.
> The lower textarea shows you the exact string that has been generated
> using
> | delimiters and the div shows you how to display it as HTML.
>
>
> <%
> Option Explicit
>
> Dim msTextIn : msTextIn = Request.Form("txtInput")
> Dim msTextOut : msTextOut = ""
>
> If msTextIn <> "" Then
> msTextOut = PipeDelimit(msTextIn)
> End If
>
> Function PipeDelimit(rsIn)
>
> Dim asLines : asLines = Split(rsIn, vbCrLf)
> Dim rgx : Set rgx = NewRegExp("\s+", true, false)
> Dim i
> For i = 0 To UBound(asLines)
> asLines(i) = rgx.Replace(Trim(asLines(i)), " | ")
> Next
>
> PipeDelimit = Join(asLines, vbCrLf)
>
> End Function
>
> %>
>
>