Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

dbf2mysql parameter, WWWXXXAPC, wwwxxxAPC, How to unsubscrube from dategen spam, docmd.close 2585, WWWXXXDOCO, nu vot, dhcpd lease file "binding state", WWWXXXDOCO, how to setup procmail to process html2text

Links

XODOX
Impressum

#1: replacing a space or something like that

Posted on 2008-04-01 05:44:36 by 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

Report this message

#2: Re: replacing a space or something like that

Posted on 2008-04-01 05:57:34 by 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

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

thanks again

Report this message

#3: Re: replacing a space or something like that

Posted on 2008-04-01 10:45:44 by Anthony Jones

"Bam" <bam@gig-gamers.com> 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

Report this message

#4: Re: replacing a space or something like that

Posted on 2008-04-01 15:45:51 by Daniel Crichton

Bam wrote on Tue, 1 Apr 2008 08:49:11 -0500:



> "Anthony Jones" <Ant@yadayadayada.com> wrote in message news:ebnvHT9kIHA.5160@TK2MSFTNGP05.phx.gbl...
>> "Bam" <bam@gig-gamers.com> 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

Report this message

#5: Re: replacing a space or something like that

Posted on 2008-04-01 15:49:11 by Bam

"Anthony Jones" <Ant@yadayadayada.com> wrote in message
news:ebnvHT9kIHA.5160@TK2MSFTNGP05.phx.gbl...
> "Bam" <bam@gig-gamers.com> 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.

Report this message

#6: Re: replacing a space or something like that

Posted on 2008-04-01 17:06:57 by Bam

>> "Anthony Jones" <Ant@yadayadayada.com> wrote in message
>> news:ebnvHT9kIHA.5160@TK2MSFTNGP05.phx.gbl...
> >> "Bam" <bam@gig-gamers.com> 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

Report this message

#7: Re: replacing a space or something like that

Posted on 2008-04-01 22:08:18 by Anthony Jones

"Bam" <bam@gig-gamers.com> wrote in message
news:47f2405b$0$6473$4c368faf@roadrunner.com...
> >> "Anthony Jones" <Ant@yadayadayada.com> wrote in message
> >> news:ebnvHT9kIHA.5160@TK2MSFTNGP05.phx.gbl...
> > >> "Bam" <bam@gig-gamers.com> 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

Report this message

#8: Re: replacing a space or something like that

Posted on 2008-04-03 06:10:38 by 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.

Report this message

#9: Re: replacing a space or something like that

Posted on 2008-04-03 23:42:42 by Anthony Jones

"Bam" <bam@gig-gamers.com> 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

Report this message

#10: Re: replacing a space or something like that

Posted on 2008-04-04 04:39:44 by 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

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), " | ")

Report this message

#11: Re: replacing a space or something like that

Posted on 2008-04-04 07:26:19 by Bam

> 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 <br>

Report this message

#12: Re: replacing a space or something like that

Posted on 2008-04-04 08:57:18 by Anthony Jones

"Bam" <bam@gig-gamers.com> 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.

> 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

Report this message

#13: Re: replacing a space or something like that

Posted on 2008-04-04 09:01:18 by Anthony Jones

"Bam" <bam@gig-gamers.com> 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 <br>
>

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

Report this message

#14: Re: replacing a space or something like that

Posted on 2008-04-04 20:13:00 by 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

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



any idea on this?

I have checked, and the data is passing from the form to this page.

Report this message

#15: Re: replacing a space or something like that

Posted on 2008-04-04 21:35:05 by 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:

================================================
<pre>
<%
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
%>
</pre>
================================================


However why not use some jscript?

================================================
<pre>
<%
t = "hi 0 hi" & vbCrLf & "there there"
r = rgxReplaceGlob(t, " | ")
Response.Write r
%>
</pre>

<script language='javascript' runat='server'>
function rgxReplaceGlob(tx,s) {
tx = tx.replace(/[\r\n]+/g,'@#@').replace(/\s+/g,s);
return tx.replace(/@#@/g,'\n');
};
</script>
================================================

my

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Report this message

#16: Re: replacing a space or something like that

Posted on 2008-04-04 22:07:47 by Anthony Jones

"Bam" <bam@gig-gamers.com> 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

%>
<html>
<head>
<title>Test Formatting</title>
<style>
textarea {width:100%}
div {border:1px solid blue}
</style>
</head>
<body>
<form action="test.asp" method="POST">
<textarea name="txtInput"><%=msTextIn%></textarea>

<textarea><%=msTextOut%></textarea>

<input type="submit" value="Go" />
<form>
<div>
<%=Replace(Server.HTMLEncode(msTextOut),vbCrLf,"
")%>
</div>
</body>
</html>
<%
Function NewRegExp(rsPattern, rbGlobal, rbCaseInsensitive)

Set NewRegExp = new RegExp
NewRegExp.Pattern = rsPattern
NewRegExp.Global = rbGlobal
NewRegExp.IgnoreCase = rbCaseInsensitive

End Function
%>



--
Anthony Jones - MVP ASP/ASP.NET

Report this message

#17: Re: replacing a space or something like that

Posted on 2008-04-04 23:40:16 by 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
>
> %>
> <html>
> <head>
> <title>Test Formatting</title>
> <style>
> textarea {width:100%}
> div {border:1px solid blue}
> </style>
> </head>
> <body>
> <form action="test.asp" method="POST">
> <textarea name="txtInput"><%=msTextIn%></textarea>

> <textarea><%=msTextOut%></textarea>

> <input type="submit" value="Go" />
> <form>
> <div>
> <%=Replace(Server.HTMLEncode(msTextOut),vbCrLf,"
")%>
> </div>
> </body>
> </html>
> <%
> Function NewRegExp(rsPattern, rbGlobal, rbCaseInsensitive)
>
> Set NewRegExp = new RegExp
> NewRegExp.Pattern = rsPattern
> NewRegExp.Global = rbGlobal
> NewRegExp.IgnoreCase = rbCaseInsensitive
>
> End Function
> %>
>
>
>
> --
> Anthony Jones - MVP ASP/ASP.NET
>
>
>

thanks Anthony, you rock!!

Report this message