Regex problem [modified]
-
Hi guys, im new here.. I've got a problem with a regular expression i am trying to make! I want to match all '{' or '}' characters, that are not alone on a row. There are, as always, an exception: there can be two brackets though, if there is one or less instructions between them. ### The following are examples that should not match with the regex:
string myStr = new string { "Hi", "!" }; string myStr = new string { "Hi", "!" }; int myProperty { get { return myInt; } set { myInt = value; } }
### the following are examples that should match:public class myClass { internal int MyMethod(int input){ public int myProperty { // <- this line get { log(DateTime.Now); return myInt; } // <- this line too
etc... Hopefully you get what I am trying to do ^^ Anyways, this is what i have got now(?m:(?:(? which only matches the ones that are not alone on a row, please help me! ^^ fafafa, ringakta icke sådant som bringa ack så naggande högönsklig välmåga å baronens ära.
-
Hi guys, im new here.. I've got a problem with a regular expression i am trying to make! I want to match all '{' or '}' characters, that are not alone on a row. There are, as always, an exception: there can be two brackets though, if there is one or less instructions between them. ### The following are examples that should not match with the regex:
string myStr = new string { "Hi", "!" }; string myStr = new string { "Hi", "!" }; int myProperty { get { return myInt; } set { myInt = value; } }
### the following are examples that should match:public class myClass { internal int MyMethod(int input){ public int myProperty { // <- this line get { log(DateTime.Now); return myInt; } // <- this line too
etc... Hopefully you get what I am trying to do ^^ Anyways, this is what i have got now(?m:(?:(? which only matches the ones that are not alone on a row, please help me! ^^ fafafa, ringakta icke sådant som bringa ack så naggande högönsklig välmåga å baronens ära.
I started trying to help you, but I'm still not exactly sure what you are trying to capture... It appears that you have a class and you only want to capture certain parts of the class? Are you looking for all of the data between the { and } or just the location of each brace? Hogan
-
I started trying to help you, but I'm still not exactly sure what you are trying to capture... It appears that you have a class and you only want to capture certain parts of the class? Are you looking for all of the data between the { and } or just the location of each brace? Hogan
The location of the braces that are not correctly placed according to my code standard ;)
fafafa, ringakta icke sådant som bringa ack så naggande högönsklig välmåga å baronens ära.