﻿/// <reference path="~/Scripts/ByteStorm/_BSC_Interface.js" />
(function(){
	BSC.R = function()
    {
		/// <summary>Javascript data cache 1</summary>
		return {
            Email:/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i,
            /*
                ^((?>[a-zA-Z\d!#$%&'*+\-/=?^_`{|}~]+\x20*|"((?=[\x01-\x7f])[^"\\]|\\[\x01-\x7f])*"\x20*)*(?<angle><))?((?!\.)(?>\.?[a-zA-Z\d!#$%&'*+\-/=?^_`{|}~]+)+|"((?=[\x01-\x7f])[^"\\]|\\[\x01-\x7f])*")@(((?!-)[a-zA-Z\d\-]+(?<!-)\.)+[a-zA-Z]{2,}|\[(((?(?<!\[)\.)(25[0-5]|2[0-4]\d|[01]?\d?\d)){4}|[a-zA-Z\d\-]*[a-zA-Z\d]:((?=[\x01-\x7f])[^\\\[\]]|\\[\x01-\x7f])+)\])(?(angle)>)$
            */
            Name:/([.]+)/g,
            Password:/(?=.*([a-z]|[A-Z]))([\x20-\x7E]){4,10}$/i, /*validere de 10 første tegn : upper and lower case letters fra a-z + special tegn fra 20 til 7E + */
            PositiveInteger:/^\d+$/,
            NonEmptyString:/[.]+/,            
            Integer:/^\d+$/,
            WindowPath:/^\w*$/,
            QueryArray:/(\d|\w*)[,]]*/g,
            Query:new RegExp("([^=]*)=([^&]*)[&]?","g"),///([^=]*)=([^&]*)[&]?/g, // /^((?:[a-zA-Z0-9_]+\=[a-zA-Z0-9_]+)?(?:\&[a-zA-Z0-9_]+\=[a-zA-Z0-9_]+)*)$/,
            IsQuery:/[=]/g,
            Date:/^((((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|([1-2][0-9]))))[\-\/\s]?\d{2}(([02468][048])|([13579][26])))|(((((0?[13578])|(1[02]))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\-\/\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\-\/\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))[\-\/\s]?\d{2}(([02468][1235679])|([13579][01345789]))))(\s(((0?[1-9])|(1[0-2]))\:([0-5][0-9])((\s)|(\:([0-5][0-9])\s))([AM|PM|am|pm]{2,2})))?$/,
            //TextField:new RegExp("(script)|(&lt;)|(&gt;)|(%3c)|(%3e)|(SELECT) |(UPDATE) |(INSERT) |(DELETE)|(GRANT) |(REVOKE)|(UNION)|(&amp;lt;)|(&amp;gt;)","gm"),
            TextField:new RegExp("(<script)|(</script>)|(&lt;)|(&gt;)|(%3c)|(%3e)|(SELECT) |(UPDATE) |(INSERT) |(DELETE)|(GRANT) |(REVOKE)|(UNION)|(&amp;lt;)|(&amp;gt;)","gm"),
            Input:/^[^<>^]+$/m,
            InputCorrectText: /<[^<]+?/m,
            ProfileKey: /^([\w\._\-]+)$/
		};
    }();
})();
/*
(\w(\s)?)+


^[a-zA-Z0-9]+$
Description  	
it will check for alphanumeric (Alpha Numeric) values.
Matches 	
adad1213 | 1231dfadfa | dfad123dfasdfs
Non-Matches 	
dfa@#12313 | *(*sdfasdfadfd | $fffsdg121ddd#$f1q


^(?:[ -~]{10,25}(?:$|(?:[\w!?.])\s))
 Word Break
 Description  	
Word Break. This regex can be used to break a long line of text on a full word. The qualifiers specify the minimum and maximum number of character allow before the break and can be changed according to your need. Blogge about this here http://regexadvice.com/blogs/mash/archive/2005/02/09/324.aspx
Matches 	
This is just a simple sample
Non-Matches 	
A sample

(\w(\s)?)+
Description  	
Used to verify that the string consists of only A-z, 0 - 9 and underscore. Several words allowed, only one space between them. No spaces up front. Hey, I know it's easy, but it was not in the library! Plus, the test option here is not working well all the time.
Matches 	
Test | TesT | tesT9 _test9
Non-Matches 	
\\\

(<\/?)(?i:(?<element>a(bbr|cronym|ddress|pplet|rea)?|b(ase(font)?|do|ig|lockquote|ody|r|utton)?|c(aption|enter|ite|(o(de|l(group)?)))|d(d|el|fn|i(r|v)|l|t)|em|f(ieldset|o(nt|rm)|rame(set)?)|h([1-6]|ead|r|tml)|i(frame|mg|n(put|s)|sindex)?|kbd|l(abel|egend|i(nk)?)|m(ap|e(nu|ta))|no(frames|script)|o(bject|l|pt(group|ion))|p(aram|re)?|q|s(amp|cript|elect|mall|pan|t(r(ike|ong)|yle)|u(b|p))|t(able|body|d|extarea|foot|h|itle|r|t)|u(l)?|var))(\s(?<attr>.+?))*>
Description  	
This RE will match all the valid elements in HTML 4.01
Matches 	
<HTML> | <a href="link.html">Link</a>
Non-Matches 	
<xml> | <phonytag> | <image>


^[^<>`~!/@\#}$%:;)(_^{&*=|'+]+$
Description  	
A general string validation to insure that NO malicious code or specified characters are passed through user input. This will allow you to input any characters except those specified. The expression above does not allow user input of &lt;&gt;`~!/@\#}$%:;)(_^{&amp;*=|'+. Input as many invalid characters you wish to deny. This really works!
Matches 	
This is a test
Non-Matches 	
<href = | <br> | That's it


(script)|(&lt;)|(&gt;)|(%3c)|(%3e)|(SELECT) |(UPDATE) |(INSERT) |(DELETE)|(GRANT) |(REVOKE)|(UNION)|(&amp;lt;)|(&amp;gt;)
Description  	
This Blacklist RegEx is designed to search a user input for any malicious code or SQL injection attempts.
Matches 	
http://www.domain.com/page.asp?param=&lt;/script&gt; | https://www.domain.com/page.asp?param=;SELECT
Non-Matches 	
https://www.domain.com/page.asp?param=RealParam


^[0-9]{1,}(,[0-9]+){0,}$
Description  	
It could be use to validate html input form (checkbox, optionbox, selectbox) when you have multiple numeric value under one field name. The validation is that the user have at lease chose one or more!
Matches 	
1111 | 47,26,2,1,1111,12 | 25,1245,2122,23232
Non-Matches 	
111, | 1a1,111,1212,23 | 11aa,aaa,asas,asa


(?<FirstName>[A-Z]\.?\w*\-?[A-Z]?\w*)\s?(?<MiddleName>[A-Z]\w*|[A-Z]?\.?)\s?(?<LastName>[A-Z]\w*\-?[A-Z]?\w*)(?:,\s|)(?<Suffix>Jr\.|Sr\.|IV|III|II|)
Description  	
A regex that attempts to accurately parse the elements from a proper name where the format is in &lt;&lt;First, Last&gt;&gt; order or some permutation of that order. Critiques and suggestions for improvement are welcome.
Matches 	
David F Walker | J. S. Smith, Jr. | Catherine Zeta-Jones
Non-Matches 	
oscar peterson


^([4]{1})([0-9]{12,15})$
Description  	
Validate against a visa card number. All visa cards start with a 4 and are followed by 12 to 15 more numbers.
Matches 	
4125632152365 | 418563256985214 | 4125632569856321
Non-Matches 	
3125652365214 | 41256321256 | 42563985632156322

^([51|52|53|54|55]{2})([0-9]{14})$
Description  	
Validate against any mastercard number. All MC's start with a number between 51 and 55 and are followed by 14 other numbers.
Matches 	
5125632154125412 | 5225632154125412 | 5525632154125412
Non-Matches 	
5625632154125412 | 4825632154125412 | 6011632154125412


(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{6,15})$
Description  	
I built this expression to test a string in ASP for valid username and password constraints. It can be adapted for any number of scenerios. For instance in this case, we needed to ensure the username someone wanted was not all numbers or all letters and was 6-15 characters in length with no special characters. This expression tests negatively for all number cases, then all letter cases, and lastly tests for only alphanumeric characters in the required range. In other words: the match must be alphanumeric with at least one number, one letter, and be between 6-15 character in length.
Matches 	
C2dfeed | sporttrak1 | 11223a
Non-Matches 	
pookie | d34_fff | 123456

*/    
