Results 1 to 4 of 4

Thread: regex little question pls

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    589

    regex little question pls

    If I have a regex like this:
    Regex objAlphaNumericPattern = new Regex(">[&nbsp;]*[\\s]*[a-zA-Z0-9\x0600-\x06ff\x00DF]+[&nbsp;]*<");

    and I want to include these 2 characters also to be take into consideration [ and ]

    How do I specify them inside my regex
    Thanks
    Thanks a lot for your help.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: regex little question pls

    Use the escape character \

    \[

    and

    \]

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2006
    Posts
    589

    Re: regex little question pls

    Thanks a lot Mendhak
    Thanks a lot for your help.

  4. #4
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: regex little question pls

    Also, there is an escape function to do this automatically for you:
    VB Code:
    1. Dim myLiteralString As String = "Is this going to cause rx errors? I bet so. What is 1\6, or 5+1?"
    2.         Dim myRegexString As String = System.Text.RegularExpressions.Regex.Escape(myLiteralString)

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