RSS

Category Archives: Common

Regular Expressions Patterns


RegExp

  • Integer (positive and negative)
    • ^[+-]?\d+$
    • ^[+-]?[0-9]+$
    • Matches: any signed integer
  • Integer (positive)
    • ^[0-9]+$
    • Matches: any positive signed integer
  • Integer (negative)
    • ^[-][0-9]+$
    • Matches: any negative signed integer
  • Decimal (positive and negative)
    • ^[-+]?\d+(\.\d+)?$
    • ^[+-]?[0-9]*(?:\.[0-9]*)?$
    • Matches: 123 | -123.45 | +123.56
  • Decimal (positive)
    • ^[+]?[0-9]*(?:\.[0-9]*)?$
    • Matches: 123 | 123.45 | +123.56
  • Decimal (negative)
    • ^[-][0-9]*(?:\.[0-9]*)?$
    • Matches: -123 | -123.45 | -123.56
  • Number (positive and negative)
    • ^[+-]?([0-9]*\.?[0-9]+|[0-9]+\.?[0-9]*)([eE][+-]?[0-9]+)?$
    • Matches: 23 | -17.e23 | +.23e+2  
  • Natural Number
    • ^[0-9]*[1-9]+$|^[1-9]+[0-9]*$
  • Alphabetical
    • [^a-zA-Z]
    • Matches: ABC | Test | xyz
  • Alphanumeric
    • [^a-zA-Z0-9]
    • ^[a-zA-Z0-9_]*$
    • Matches: ABC | Test123
  • E-Mail
    • ^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$
    • Matches: AhmedNegm@WindowsLive.com
  • Date
    • ^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))|^(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d+$
    • Matches: this expression validates a date field in dd/mm/yyyy  and mm/dd/yyyy format
  • Temperature
    • ^[-+]?\d*(\.\d+)?( )?(Celsius|C|c|CELSIUS|Fahrenheit|F|f|FAHRENHEIT|Kelvin|K|k|KELVIN)?$
    • Matches: 34F | 56 Celsius | 22C
  • Egyptian National ID
    • (2|3)[0-9][1-9][0-1][1-9][0-3][1-9](01|02|03|04|11|12|13|14|15|16|17|18|19|21|22|23|24|25|26|27|28|29|31|32|33|34|35|88)\d\d\d\d\d
  • Egyptian Mobile Number
    • (201)[0-9]{9}
  • Hexadecimal String
    • ^[0-9A-Fa-f]+$
    • Matches: 062706440644064700200623064306280631
 
 

Tags: , , , , , , , , , , , , , , , , , , ,

World Countries Details!


countriesFind the following Excel file which contains all public details about world countries, you will get:

  • ISO3166 Alpha 2 .. like EG
  • ISO3166 Alpha 3 .. like EGY
  • ISO3166 Number 3 .. like 818
  • English Name .. like Egypt
  • Local Name .. like Mişr
  • Local Long Name .. like Jumhūrīyat Mişr al ‘Arabīyah
  • English Capital Name .. like Cairo
  • Local Capital Name .. like Al Qāhirah
  • Continent .. like AF
  • Demomyn .. like Egyptian
  • Latitude .. like 27
  • Longitude .. like 30

Click Countries to download the file or get it from my dropbox.

 
Leave a comment

Posted by on November 5, 2014 in Common

 

Tags: ,

Microsoft Exam .. 100% Free!! (EXPIRED!)


mcp-certified-logo

I’m Microsoft Certified Trainer (MCT), I can help you to get a free exam voucher for any of Microsoft exams.

Just send me your:

  • First Name
  • Last Name
  • Microsoft Mail

Kindly, don’t do that unless you need to leave others to get the chance, reply on the same thread with the requested details and after registration you will get an email contains all of details which you want.

Notes:

  • You’ve the chance to get one voucher only.
  • You should use it before November 30, 2014.
  • You cannot sell it, because it is assigned to you.
  • Don’t use different mail to get more than one voucher, because of your records will be distributed on more than one transcript, it’s illegal issue.
  • There’re limited seats, hurry up!
  • Feel free to contact me (a.negm@outlook.com) if you want to get further info about the issue.
 
14 Comments

Posted by on October 31, 2014 in Common

 

Tags: , , ,

How to convert Value Pair list to Table in SQL Server?


key-value-pair-mongoDB

DECLARE @NameValuePairs VARCHAR(MAX) = 'FirstName=Ahmed;LastName=Negm;Age=26;Address=Egypt;Job=Senior Software Developer'
DECLARE @NameValuePair VARCHAR(100)
DECLARE @Name VARCHAR(50)
DECLARE @Value VARCHAR(50)
DECLARE @Property TABLE (
 [Name] VARCHAR(50),
 [Value] VARCHAR(50)
)
WHILE LEN(@NameValuePairs) > 0
BEGIN
 SET @NameValuePair = LEFT(@NameValuePairs, 
 ISNULL(NULLIF(CHARINDEX(';', @NameValuePairs) - 1, -1),
 LEN(@NameValuePairs)))
 SET @NameValuePairs = SUBSTRING(@NameValuePairs,
 ISNULL(NULLIF(CHARINDEX(';', @NameValuePairs), 0),
 LEN(@NameValuePairs)) + 1, LEN(@NameValuePairs))
SET @Name = SUBSTRING(@NameValuePair, 1, CHARINDEX('=', @NameValuePair) - 1)
SET @Value = SUBSTRING(@NameValuePair, CHARINDEX('=', @NameValuePair) + 1, LEN(@NameValuePair))
INSERT INTO @Property ( [Name], [Value] ) VALUES ( @Name, @Value )
END

SELECT * FROM @Property

2014-05-05_12-01-00

 
Leave a comment

Posted by on May 5, 2014 in Common

 

Tags: , , , , , , , , ,

10 Reasons why your employees hate you!!


 

pathsofhate_stills_01

Firstly, this topic is copied from here, and I know that it isn’t related to our blog major trend, but it is so important for you in your work environment.

In the world of employees, a good boss is differentiated from a bad boss by the way the boss makes the employees feel. They also assess the boss based on his or her contribution – or lack thereof – to their ability to get their jobs done successfully.

Employees tolerate a lot of bad boss behavior. Many bosses are untrained, uncaring, and not held accountable for their actions and interaction with employees. Some were promoted to jobs above their competence to perform. Bad management practices weigh heavily in whether your employees hate you.

Read the rest of this entry »

 
Leave a comment

Posted by on April 2, 2014 in Common

 

Tags: , , , , , , , , ,

Developer – How To Market Yourself as a Software Developer


 
Leave a comment

Posted by on April 2, 2014 in Common

 

SQL SERVER – 9 Things You Should be Doing with Your Backups


Awesome ..!!

 
Leave a comment

Posted by on February 3, 2014 in Common

 

Windows 8: The End of the Beginning


As sure as day follows night, as sure as eggs is eggs and as sure as every odd-numbered Star Trek movie is shit ~ Simon Pegg, Spaced

That was the rule: every odd-numbered Star Trek movie sucked. Star Trek: The Motion Picture was weak; Wrath of Khan was awesome; Search for Spock was abominable; The Voyage Home seemed better at the time than it does now; the Final Frontier may as well have had Captain Kirk in a leather jacket water-skiiing over a circling fin; The Undiscovered Country was clever and well written; Generations was just… weird; First Contact was a brilliant showing for the TNG crew; Insurrection was very, very dull. Then Nemesis, the tenth film, tried to ruin the whole thing by being possibly the suckiest Star Trek film ever. But that didn’t disprove the rule, which stated that the odd-numbered movies sucked, not that the even-numbered ones didn’t. And then JJ Abrams came along and rebooted the franchise, with a movie that is either number 11 or number 1 but is definitely odd-numbered either way, and is utterly fantastic.

So now I keep seeing tweets and blog posts and articles in journals I respect expressing the worry that Windows 8 is going to be “another Vista” or “another ME”, as though there were a rule that every other Windows release has to be a turkey. Thus I am compelled to post this, by way of respectful disagreement with these idiots. I’ll get onto why I don’t think Windows 8 is, or will be, a failure, but I’ll start by asking this question:

Read the rest of this entry »

 
Leave a comment

Posted by on August 21, 2012 in Common

 

Tags: , , , ,

Welcome to my blog .. !!


This is my first post in this technical blog, I hope you to enjoy your time and increase your technical knowledge.

Best regardsAhmed Negm.

 
Leave a comment

Posted by on October 13, 2011 in Common