Regex expressions (“illegal escape character”) -


i using regular expressions finds strings

"override="/var/logs/test/" or "override="/var/logs/sample/" in .xml file.

i have final string pattern:

public final static string regex_logpath="override=\"\/var\/logs\/([^\"]*)\/"; 

it works fine (i build successful (total time: 0 seconds) while running project in netbeans ide), strings found. when attemp compile code .jar file, error msg:

error: illegal escape character

public final static string regex_logpath="override=\"\/var\/logs\/([^\"]*)\/"; 

compile failed; see compiler error output details. build failed (total time: 0 seconds)

you don't have escape forwards slashes, not special (escape-able) characters.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -