From: Bam on


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


From: Anthony Jones on

"Bam" <bam(a)gig-gamers.com> wrote in message
news:47f449a7$0$17342$4c368faf(a)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




From: Bam on
>> >
>> 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), " | ")


From: Anthony Jones on

"Bam" <bam(a)gig-gamers.com> wrote in message
news:47f585a8$0$1091$4c368faf(a)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




From: Bam on


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