Regular Expression
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Regular Expression

  1. #1
    Join Date
    Mar 2007
    Posts
    5

    Question Regular Expression

    hi

    all


    i m using regular expression for parsing outlook mails

    like

    From: Cliff Young
    To: Support
    Sent: Monday, July 04, 2005 5:03 PM
    Subject: Re: Wallpaper changer

    from the body of mail for multiple threads in a mail.

    i want a regular exp for getting continuous selected text from

    From: to Subject:

    but the problem is regular exp terminates itself as the line ends

    it might work with above example but not with the below

    when body contains the text like

    From:</B>
    <A title=corcliff@prodigy.net.mx
    href="mailto:corcliff@prodigy.net.mx">Cliff Young</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>To:</B> <A title=support@systweak.com
    href="mailto:support@systweak.com">support@systweak.com</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, July 04, 2005 7:56
    AM</DIV>
    <DIV style="FONT: 10pt arial"><B>Subject:</B> Wallpaper changer</DIV>


    i just want to use regular expr for continuous multiline selection for

    From: ********* Subject:.*

    so help me in finding substrings using regular expr

    i m using visual basic for experiment

    pls tell me where i could find the related articles

    thanks a lot in advance
    Edit/Delete Message

  2. #2
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,877

    Re: Regular Expression

    Why not just Split() the text into lines, and then parse each one?
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Sep 2006
    Posts
    392

    Re: Regular Expression

    I am not able to get your requirements.Please explain
    VS 2005

  4. #4
    Join Date
    Jan 2006
    Location
    Chicago, IL
    Posts
    14,877

    Re: Regular Expression

    This will split a file, and double-space it:
    Code:
    Option Explicit
    
    Private Sub Form_Load()
      Dim x As Integer, st As String
      Dim ff As Integer
      Dim strBuff As String
      Dim str() As String
      ff = FreeFile
      Open App.Path & "\to do.txt" For Input As #ff
    	strBuff = Input(LOF(ff), ff)
      Close #ff
      ' ----------------- two ways to skin a cat --------------
      MsgBox "Lines = " & Len(strBuff) - Len(Replace(strBuff, vbCrLf, "x")) + 1
      ' -------------------------------------------------------
      str() = Split(strBuff, vbCrLf)
      MsgBox "There are " & UBound(str) + 1 & " lines in the file"
      For x = 0 To UBound(str)
    	st = st & str(x) & vbCrLf & vbCrLf
      Next x
      MsgBox st
    End Sub
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    Join Date
    Mar 2007
    Posts
    5

    Re: Regular Expression

    hi
    i m using this kind of regular expression
    ^[ >]*From:.* \n^[ >]*To:.* \n^[ >]*Subject:.*

    which can get desired result when mail is "text mail"
    like following

    " Hi Sunaina,
    I got ASO installed. Appreciate your help.

    Kind Regards,

    Bruce



    >From: "Systweak Support"
    >To: "BRUCE COUNTRYMAN"
    >Subject: Re: Zip file
    >Date: Thu, 2 Jun 2005 17:34:40 +0530
    >
    >Dear Bruce
    >
    >Thank you for e-mailing us.
    >
    >Regarding your query, we are sending you the setup file of registered
    >version of Advanced System Optimizer as zipped attachment with this
    >e-mail, please note that you need to unzip it before trying to install
    >the product.
    >This should help.
    >
    >
    "



    but not working with mails containing html body format

    like on following mail






    "
    <DIV>&nbsp;</DIV>
    <DIV>Hi,</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>Basically your instructions seem to have fouled everything up. I did as you
    suggested and on boot up the wallpaper screen appears on the desktop....I
    minimize it but no icon appears on the taskbar. When I open System Optimizer and
    then click on Beatify Windows and then on Wallpaper Changer a window opens
    saying that Wallpaper Changer is already running but actually it isn't as the
    wallpaper never changes. I have attached a window for you to look at which would
    indicate that Wallpaper Changer is active.</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;</DIV>
    <BLOCKQUOTE dir=ltr
    style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
    <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
    <DIV
    style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
    <A title=support@systweak.com href="mailto:support@systweak.com">Systweak
    Support</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>To:</B> <A title=corcliff@prodigy.net.mx
    href="mailto:corcliff@prodigy.net.mx">Cliff Young</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, July 05, 2005 6:33
    AM</DIV>
    <DIV style="FONT: 10pt arial"><B>Subject:</B> Re: Wallpaper changer</DIV>
    <DIV><BR></DIV>
    <DIV><FONT face=Arial size=2>Dear Sir/Madam</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Thank you for e-mailing us.</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2><BR>
    <P style="MARGIN-LEFT: 10px">
    <P><FONT face="arial, helvetica, sans-serif">Regarding your query, please
    follow the steps&nbsp;below to add&nbsp;application on startup: </FONT></P>
    <P><FONT face="arial, helvetica, sans-serif">1. Select "Startup Cleaner
    &amp;&nbsp;Autorun Manager"&nbsp;in&nbsp;left panel option "System Cleaners"
    of Advanced System Optimizer.<BR>2. Click to select&nbsp;"All user"&nbsp;in
    the left panel.<BR>3. Now, click on "Add" button on the top toolbar.<BR>4.
    In&nbsp;dialog box, type the display name for the
    application.<BR>5.&nbsp;Locate the executable file of the application in
    "Application Path" field.<BR></FONT><FONT
    face="arial, helvetica, sans-serif"></FONT></P>
    <P><FONT face="arial, helvetica, sans-serif">Finally, click ‘OK’ .</FONT></P>
    <P>This should help.</P>
    <P style="MARGIN-LEFT: 10px">
    <P class=MsoNormal
    style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN
    style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><FONT
    face="arial, helvetica, sans-serif">Please do not hesitate to contact us,
    should you have further queries.<o></o></FONT></SPAN></P>
    <P class=MsoNormal
    style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><o><FONT
    face="arial, helvetica, sans-serif">&nbsp;</FONT></o></P>
    <P class=MsoNormal
    style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><FONT
    face="arial, helvetica, sans-serif">Regards</FONT></P>
    <P class=MsoNormal
    style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN
    style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o><FONT
    face="arial, helvetica, sans-serif">&nbsp;</FONT></o></SPAN></P>
    <P class=MsoNormal
    style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN
    style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><FONT
    face="arial, helvetica, sans-serif">Sunaina
    Hemraj<o></o></FONT></SPAN></P>
    <P class=MsoNormal style="MARGIN: 5pt 0in; mso-layout-grid-align: none"><FONT
    face="arial, helvetica, sans-serif">Systweak Support
    Team<BR>------------------------------------------------------------------------<BR>If
    you are not satisfied with the answer, please contact the Chief Development
    Officer directly at
    cdo@systweak.com<BR>----------------------------------------------------------------<BR>VERY
    IMPORTANT: If you are responding to this e-mail, please include all original
    message text.</FONT></P>
    <P class=MsoNormal
    style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><SPAN
    style="FONT-SIZE: 10pt; FONT-FAMILY: Arial"><o><FONT
    face="arial, helvetica, sans-serif">&nbsp;</FONT></o></SPAN></P></FONT></DIV>
    "

    hope u pls help me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center