Sunday, 15 March 2015

java - Trying to regex match a line in a log file that contains my "app" variable without file extension -



java - Trying to regex match a line in a log file that contains my "app" variable without file extension -

i apologise new groovy but,

there line in log file:

[info] uploading: //blah/client_website-versionnumber.war

i have variable established sql statement "apps" is: client_website.war

my problem can't work out how form if statement find "client_website.war" in log file, because there "-versionnumber" right in middle of variable in between client-website , .war. there way match half of apps variable or something? help appreciated.

you utilize character class define collection/range of allowed characters version number. example,

client_website[0-9.-]*\.war

would match client_website, followed 0 or more (*) characters collection "any ascii digit (0-9), dot (.) or dash (-)", followed \.war.

this match nonsensical values client_website.....war or client_website-.-.-.-.war, if don't need exclude such values, regex should fine.

if decide extend character class, create sure dash remains @ end of class; otherwise interpreted range indicator (as in 0-9!).

java regex groovy

No comments:

Post a Comment