p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: string manipulation - made easy


Message #1 by dont worry <aspmailbox@y...> on Thu, 10 May 2001 16:21:16 -0700 (PDT)
To reuse the matched substring use the execute method to store the match in
the matches collection and then you can reuse the value later on.

dim oRegEx, oMatches
set oRegEx = New RegExp
oRegEx.Pattern = "/(\<.+\>)/"
set oMatches = oRegEx.Execute(str1)
str2 = oRegEx.Replace(str1, "")
str3 = str1 & oMatches(0).Value

John
----- Original Message -----
> Subject: RE: string manipulation - made easy
> From: baohuan@w... (Baohuan Zhang)
> Date: Fri, 11 May 2001 10:37:28 +0100
> X-Message-Number: 6
>
> How about:
>
> <%
> Dim str1, str2
> str1 = "asp@m...<okayemail.com>"
> set Regexp = New RegExp
> RegExp.Pattern = "/\<.+\>/"
> str2 = RegExp.Replace(str1, "")
> Response.Write "str2 = " & str2 & "<br>"
> %>
>
> Regards,
>
> Baohuan
>
> -----Original Message-----
> From: dont worry [mailto:aspmailbox@y...]
> Sent: 11 May 2001 00:21
> To: Code Clinic
> Subject: [proasp_codeclinic] string manipulation - made easy
>
>
> I have the following string
> value = asp@m...<okayemail.com>
> 1)what is the best way to remove the <okayemail.com>
> to leave value=asp@m...
> 2)I will need to beable to added back as well it as
> well.
> 3)I'm trying midfunction, but any easier ideas would
> be appreciated.
> thanks
>



  Return to Index