Results 1 to 2 of 2

Thread: [RESOLVED] Regex assitence.

Threaded View

  1. #1

    Thread Starter
    Bad man! ident's Avatar
    Join Date
    Mar 2009
    Location
    Cambridge
    Posts
    5,401

    Resolved [RESOLVED] Regex assitence.

    I cant seem to spot my regex miss take(always been poor at RX). Is only passing the first expression. I assume it's because i am passing both expressions with "text"

    vb Code:
    1. #Region "Regular Expressions"
    2.         Private Shared ReadOnly SubjectPattern As String = "(?<=<s.*>)([\s\S]*)(?=</s>)"
    3.         Private Shared ReadOnly SubjectMatch As New Regex(SubjectPattern, RegexOptions.IgnoreCase Or RegexOptions.Compiled)
    4.         Private Shared ReadOnly MessagePattern As String = "(?<=<m.*>)([\s\S]*)(?=</m>)"
    5.         Private Shared ReadOnly MessageMatch As New Regex(SubjectPattern, RegexOptions.IgnoreCase Or RegexOptions.Compiled)
    6. #End Region
    7.  
    8.         Private Sub PrivateMessage(ByVal id As String, ByVal text As String)
    9.             If Not IsInteger(id) Then
    10.                 WriteServer("Invalid ID")
    11.                 Exit Sub
    12.             End If
    13.  
    14.             Dim subMatch As Match = SubjectMatch.Match(text)
    15.             Dim msgMatch As Match = MessageMatch.Match(text)
    16.             WriteServer(SubjectMatch.ToString)
    17.             WriteServer(msgMatch.ToString)
    18.  
    19.         End Sub
    Last edited by ident; Oct 20th, 2011 at 04:48 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width