Skip to content

Instantly share code, notes, and snippets.

@TopHatCroat
Created March 24, 2017 10:57
Show Gist options
  • Save TopHatCroat/fc7b13f9e767d7c626bd11dc8f2ace47 to your computer and use it in GitHub Desktop.
Save TopHatCroat/fc7b13f9e767d7c626bd11dc8f2ace47 to your computer and use it in GitHub Desktop.
String adminRegex = "^(-admin)? ?-server (?:(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6})|(localhost)) -port ([8|9][0-9]{3}) -u ([a-zA-Z0-9-_]+) -p ([a-zA-Z0-9-_!#]+) -(pause|stop|start|stat)$";
String userRegex = "^(-korisnik)? ?-s (?:(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6})|(localhost)) -port ([8|9][0-9]{3}) -u ([a-zA-Z0-9-_]+) ?(-(a|t) (?:(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})|(([a-zA-Z0-9]([a-zA-Z0-9\\-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6})|(localhost)))? ?(-w ([0-6][0-9]{2}))?$";
String showRegex = "^(-prikaz)? ?-s ((:?([a-zA-Z]:|(http:(?:\\\\|\\/))))?(?:(?:\\\\|\\/)?(\\w[\\w ]*.*))+\\.(?:(?i)bin(?-i)))$";
@capJavert
Copy link

userRegex, ne matcha http/https za -a | -t .. isto -w se mora upisati 001 za 1, umjesto samo 1... fix:

String userRegex = "^(-korisnik)? ?-s (?:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6})|(localhost)) -port ([8|9][0-9]{3}) -u ([a-zA-Z0-9-_]+) ?(-(a|t) (?:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(((http:\/\/)|(https:\/\/))([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6})|(localhost)))? ?(-w (([1-9]{1})|([1-9]{1}[0-9]{1})|([1-5]{1}[0-9]{0,2})|600))?$";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment