regex - JAVA: replaceAll reg pattern -
considering following string:
string s = "/static/201105-3805-somerandom/images/optional-folder/filename.gif";
how can remove "static/201105-3805-somerandom/" part? "201105-3805-somerandom" part random composed of: - 6 digits - "-" char - {1, n} digit chars - "-" char - {1, n} digit , letter chars
if use "/static/[0-9]*-[0-9]*-*/";
, replaces last / instead of 1 after "{1, n} digit , letter chars", missing?
s = s.replaceall("^/static/\\d{6}-\\d{1,}-.*?/","")
Comments
Post a Comment