3
Filing cabinet:
My code:
public static void main(String[] args){
//Supondo que o readLine() esteja no loop != null
String arquivoLinha = arquivo.readLine();
Pattern padrao = Pattern.compile(arquivoLinha); //O problema está aqui
Matcher texto = padrao.matcher("http://minhapagina.php?id=");
while (texto.find()){
System.out.println(texto.group());
}
}
When the last line arrives at the fileLine variable(http://mydeletina.php?id), It happens what I didn’t want to happen: The metacharacter "?" has power, thus modifying my research. I could even use the exhaust pipe " " to ignore the "?" but how do I do that? Or at least ignore any metacharacter that is in the fileLine variable and consider it as literal.
I tried to do so:
Pattern.compile("["+"("+arquivoLinha+")"+"]");
Using the line inside the group, that inside the list to ignore the metacharacters, only that it’s not working very well.
Pattern quote.?
– Pablo Almeida