An example of positive lookbehind (Matches a group before the main expression without including it in the result):
var str = @"System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.ApplicationException: MQException is caught. Reason code: 2033, completion code: 2. ---> CompCode: 2, Reason: 2033
--- End of inner exception stack trace ---
at Multiconn.ZZZ.Web.Services.Port.EndProcess(IAsyncResult asyncResult)
at Multiconn.ZZZ.Demo.K.M.E(IAsyncResult asyncResult, WsEsParams1Response& result1, MyType result3)
--- End of inner exception stack trace ---";
Regex r = new Regex(@"(?<=Reason code: )\d+");
foreach (Match m in r.Matches(str))
Console.WriteLine(m.Value);
Keeping track of interesting places I put my feet on in the software development world.
Search This Blog
Monday, February 22, 2016
Sunday, February 21, 2016
Impefect Content-Type http response headers
Monday, December 28, 2015
Make sure you are testing/playing with regular expressions in an environment that follows the same regular expression behavior of the programming language you are using
Upon posting this question, I learn that it is mandatory, whenever testing/playing with regexes, to make sure you are using an environment that follows/matches the Regular Expression behavior of the language you are programming with.
Otherwise things will not make sense.
Check this for online sandboxes for regex testing, per programming language.
Otherwise things will not make sense.
Check this for online sandboxes for regex testing, per programming language.
Wednesday, December 16, 2015
Nuget Helpers Package
Uploaded a nuget package containing methods I have been using very often in new projects.
Below is a list of all methods provided at this point:
Nuget install command: Install-Package Helpers
Below is a list of all methods provided at this point:
Nuget install command: Install-Package Helpers
Sunday, December 13, 2015
Enforcing a given number of digits in a numeric value in Javascript
Javascript does not a built-in functionality like C#'s .ToString("0000").
To accomplish the same I came up with the following:
function setNumericFormat(value, numOfDigits, paddingChar) {
var length = value.toString().length;
if (length < numOfDigits) {
var prefix = "";
for (var i = 1; i <= numOfDigits - length; i++) {
prefix += paddingChar;
}
return prefix + value.toString();
}
return value.toString();
}
Resembles a LeftPad function...
To accomplish the same I came up with the following:
function setNumericFormat(value, numOfDigits, paddingChar) {
var length = value.toString().length;
if (length < numOfDigits) {
var prefix = "";
for (var i = 1; i <= numOfDigits - length; i++) {
prefix += paddingChar;
}
return prefix + value.toString();
}
return value.toString();
}
Resembles a LeftPad function...
Wednesday, November 25, 2015
Need to migrate your sql server database and wondering how will you get all the objects sql scripts ?
Found out that it is quite simple.
In case the link gets broken:
In case the link gets broken:
- Mouse right-click on the database in question, in the database explorer
- Select Tasks
- Select Generate Scripts
- Choose all the objects you want the scripts to be generated.
That's all.
Thursday, November 12, 2015
Project will not build after adding function or procedure to edmx
Having issues in trying to add a function/procedure to your Entity Data Model - it will not build after that ?
What's more, it works perfectly with Entity Framework version 5 ? And with 6, which you are trying now, does not ?
Well, here's the solution.
Lessons learned: there is such a thing as Entity Framework Tools for Visual Studio, and we need to make sure we have it updated/in sync with the version of Visual Studio we are using in combination with a package we have just downloaded/added to our project.
Dependencies, dependencies, dependencies...
What's more, it works perfectly with Entity Framework version 5 ? And with 6, which you are trying now, does not ?
Well, here's the solution.
Lessons learned: there is such a thing as Entity Framework Tools for Visual Studio, and we need to make sure we have it updated/in sync with the version of Visual Studio we are using in combination with a package we have just downloaded/added to our project.
Dependencies, dependencies, dependencies...
Subscribe to:
Posts (Atom)
