regex help
I am trying to this regex but I am not. is it possible?
help me!!!!
string: x*[2+[(2+y)*z]*(4+y)]-3/[(3+y)*z]
regex: ?
matches:
2+[(2+y)*z]*(4+y)
(3+y)*z
I am trying to this regex but I am not. is it possible?
help me!!!!
string: x*[2+[(2+y)*z]*(4+y)]-3/[(3+y)*z]
regex: ?
matches:
2+[(2+y)*z]*(4+y)
(3+y)*z
It appears you are trying to find the string bounded by the outermost pair of square brackets and allowing nested square brackets within the string?
Try the expression described in the following blog entry: http://blogs.msdn.com/bclteam/archive/2005/03/15/396452.aspx. The example uses angle brackets as the thing being matched, but you should be able to convert the expression to look for square brackets fairly easily.
Remember that you need to use \[ and \] to represent the actual '[' and ']' characters and be careful to distinguish between the angle brackets that are part of the expression being matched and the angle brackets that are part of the RegEx expression (?<name>subexpression).