Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Formatting string

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,59631
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Formatting string
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Formatting string - 4/30/2008 2:43:03 AM   
  collie

 

Posts: 10
Score: 0
Joined: 2/11/2008
Status: offline
Hi,

I have a code that reads a string and returns the value of Reply-To:. However, some strings may contain something like In-Reply-To:


I want to modify my code so that it will return the value only if the string contains Reply-To with no other variations (such as In-Reply-To).

What must i change in my code below?
Thanks

example of string
emailHeaderString = "Mon, 11 Feb 2008 19:15:56 +0200" & vbCrLf & _ "In-Reply-To: " & vbCrLf & _ "From: ""avital xxx"" "" & vbCrLf & _
"From: ""avital xxx"" "

emailHeaderString2 = "Mon, 11 Feb 2008 19:15:56 +0200" & vbCrLf & _
"Reply-To:" & vbCrLf & _
"From: ""avital xxx"" "

emailHeaderString1 = "Mon, 11 Feb 2008 19:15:56 +0200" & vbCrLf & _
"From: ""avital xxx"" "

emailHeaderString = "Mon, 11 Feb 2008 19:15:56 +0200" & vbCrLf & _
"In-Reply-To: " & vbCrLf & _
"From: ""avital xxx"" "

' Find position of 'Reply-To'
StartPos = InStr(emailHeaderString, "Reply-To")
Response.Write ("StartPos")
Response.Write (StartPos)
' Increment past 'Reply-To'
if (StartPos0) then
StartPos = StartPos + Len("Reply-To: ")

' Find next CR/LF
EndPos = InStr(StartPos, emailHeaderString, vbCrLf)
Response.Write ("
")
Response.Write ("EndPos")
Response.Write (EndPos)
if (EndPos0) then

replyToAddress =Mid(emailHeaderString, StartPos+1, EndPos - StartPos-2 )
'This sets the to address on the reply
if instr(replyToAddress,"@") then
Response.Write ("
")
Response.Write ( replyToAddress)
end if
end if
end if%>

      
 
 
Post #: 1
 
 RE: Formatting string - 4/30/2008 2:50:01 AM   
  ebgreen


Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
So your goal is to get the email address but only for Reply-To?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to collie)
 
 
Post #: 2
 
 RE: Formatting string - 4/30/2008 4:16:48 AM   
  collie

 

Posts: 10
Score: 0
Joined: 2/11/2008
Status: offline
yes that is my goal:-) only "reply-to:" and not any other variations such as "in-reply-to:".

(in reply to ebgreen)
 
 
Post #: 3
 
 RE: Formatting string - 4/30/2008 4:56:51 AM   
  ebgreen


Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
In that case I would suggest searching the forum for Regular Expression or Regex.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to collie)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Formatting string Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts