RegEx help for a RegEx Newb
-
Can someone help me write a regular expression that will return a string from the beginning of the input string up until a certain string is reached? I know how to do this without regular expressions, but I want to use a regular expression so users can modify the format later. Also, can someone recommend a good tutorial for using regular expressions to accomplish this kind of task using .NET? Thanks.
-
Can someone help me write a regular expression that will return a string from the beginning of the input string up until a certain string is reached? I know how to do this without regular expressions, but I want to use a regular expression so users can modify the format later. Also, can someone recommend a good tutorial for using regular expressions to accomplish this kind of task using .NET? Thanks.
www.expresso.com, or search for Expresso on this site. It's a program that helps you build and test regex. Also, the regex book from O'Reiley is pretty awesome.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Can someone help me write a regular expression that will return a string from the beginning of the input string up until a certain string is reached? I know how to do this without regular expressions, but I want to use a regular expression so users can modify the format later. Also, can someone recommend a good tutorial for using regular expressions to accomplish this kind of task using .NET? Thanks.
I use http://regexlib.com/CheatSheet.aspx for Regular Expressions. There is also a "free" application to test .NET Regular Expressions http://www.sellsbrothers.com/tools/default.aspx#regexd.
Here are some of my articles. Hope this helps! Joseph Guadagno http://www.josephguadagno.net
-
www.expresso.com, or search for Expresso on this site. It's a program that helps you build and test regex. Also, the regex book from O'Reiley is pretty awesome.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Can someone help me write a regular expression that will return a string from the beginning of the input string up until a certain string is reached? I know how to do this without regular expressions, but I want to use a regular expression so users can modify the format later. Also, can someone recommend a good tutorial for using regular expressions to accomplish this kind of task using .NET? Thanks.
-
I use http://regexlib.com/CheatSheet.aspx for Regular Expressions. There is also a "free" application to test .NET Regular Expressions http://www.sellsbrothers.com/tools/default.aspx#regexd.
Here are some of my articles. Hope this helps! Joseph Guadagno http://www.josephguadagno.net
+1 for http://regexlib.com[^]
[My Blog]
"Visual studio desperately needs some performance improvements. It is sometimes almost as slow as eclipse." - RĂ¼diger Klaehn
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe -
But there is RegEx in general and then there is .NET's flavor of RegEx. Are you recommending the O'Reilly book for .NET?
The O'Reilly book covers the different flavours in depth.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Can someone help me write a regular expression that will return a string from the beginning of the input string up until a certain string is reached? I know how to do this without regular expressions, but I want to use a regular expression so users can modify the format later. Also, can someone recommend a good tutorial for using regular expressions to accomplish this kind of task using .NET? Thanks.
Look into RegexOptions.MultiLine to change whether "." matches newlines as well... myRegex = new Regex("^.*?(?=myStringThatDelimitsTheEndOfTheMatch)"); Match m = myRegex.Match(sampleString); if (m.Success) { m.Value; // this returns only the part of the match // that occured prior to your delimiting string }