match [ (Regex) 
Author Message
 match [ (Regex)

hi
I' m using Regex to search a string in a text file. But the string ends with a [.
How can i that in Regex?? I'll tryed it with the ascii value, but no success.

my string starts with 'mach_' and ends with '['    ( [=chr(91) in ascii )
example: mach_vtr [

my code
Dim regexp As Regex = New Regex("mach_ ((.|\n)*?)" & Chr(91) , RegexOptions.IgnoreCase)
error:

parsing "mach_ ((.|\n)*?)[" - Unterminated [] set. Parameter name: mach_ ((.|\n)*?)[
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: parsing "mach_ ((.|\n)*?)[" - Unterminated [] set. Parameter name: mach_ ((.|\n)*?)[

help ?!? :-}
thanks
Pieter



Fri, 30 Apr 2004 23:09:26 GMT  
 match [ (Regex)

Almost certainly using '\[' instead of '[' or Chr(91) will work.

--
Dave Rothgery


  hi
  I' m using Regex to search a string in a text file. But the string ends with a [.
  How can i that in Regex?? I'll tryed it with the ascii value, but no success.

  my string starts with 'mach_' and ends with '['    ( [=chr(91) in ascii )
  example: mach_vtr [

  my code
  Dim regexp As Regex = New Regex("mach_ ((.|\n)*?)" & Chr(91) , RegexOptions.IgnoreCase)
  error:

  parsing "mach_ ((.|\n)*?)[" - Unterminated [] set. Parameter name: mach_ ((.|\n)*?)[
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

  Exception Details: System.ArgumentException: parsing "mach_ ((.|\n)*?)[" - Unterminated [] set. Parameter name: mach_ ((.|\n)*?)[

  help ?!? :-}
  thanks
  Pieter



Fri, 30 Apr 2004 23:48:29 GMT  
 match [ (Regex)

Quote:
> Almost certainly using '\[' instead of '[' or Chr(91) will work.

Or something like: [[]


Sat, 01 May 2004 10:49:18 GMT  
 match [ (Regex)
Yes, this also should work!


Sat, 01 May 2004 17:29:21 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. REGEX, groups and matching

2. RegEx: Pattern Matching going wrong: "\[.+\]\"

3. Filename pattern matching using regex

4. regex question on multiple word matches

5. RegEx object - Pattern Matching

6. RegExp question: match within another match

7. Seek Nearest Match if exact match not found ?

8. Seek Nearest Match if exact match not found ?

9. RegEx - sorry to bother - found the solution

10. RegEx - my personal illogical nightmare

11. Using Regex to get a block of text

12. RegEx Capturing

 

 
Powered by phpBB® Forum Software