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 - java regular expression to match file path -


i trying out create regular expression match file path in java like

c:\abc\def\ghi\abc.txt

i tried ([a-za-z]:)?(\\[a-za-z0-9_-]+)+\\? , following code

import java.util.regex.pattern;    public class retester {  public static void main(string arhs[]){      string regularexpression = "([a-za-z]:)?(\\[a-za-z0-9_-]+)+\\?";      string path = "d:\\directoryname\\testing\\abc.txt";      pattern pattern = pattern.compile(regularexpression);      boolean ismatched = pattern.matches(regularexpression,path);     system.out.println(path);     system.out.println(pattern.pattern());     system.out.println(ismatched);  }  } 

however it's giving me , false result . pls me .

thanks

java using backslash-escaping too, know, need escape backslashes twice, once java string, , once regexp.

"([a-za-z]:)?(\\\\[a-za-z0-9_.-]+)+\\\\?" 

your regexp matched literal '[-za-z0-9_-' string, , literal '?' @ end. added period in there allow 'abc.txt'..

that said, consider using mechanism determine valid file names, there different schemes (i.e. unix). java.util.file throw exception if path invalid, might alternative, although don't using exceptions control flow...


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 -