Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

regex - JavaScript RegExp Differences -


what difference between

var regex = /\d/; 

and

var regex = new regex("\d"); 

bob

both evaluate same exact regex, first literal, meaning cannot use variables inside it, cannot dynamically generate regex.

the second uses constructor explicitly , can used create dynamic regular expressions.

var x = '3', r = ( new regexp( x + '\d' ) ); r.test('3d') 

the above example of dynamically constructing regex constructor, can not in literal form.

in 99% of cases rely on first version ( literal ) regexpes in js. in advanced scenario need say, user input dynamically construct regex that's when you'll need second form.

edit #1: the first matches digit, second matches letter d. have double-escape second 1 in order equal first one, assume meant do. remember advice typed above accurate if second example new regexp('\d').

/\d/.test('3') // true ( new regexp('\d') ).test('3') // false ( new regexp('\\d') ).test('3') // true 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -