jeudi 21 juillet 2016

Performance Difference Between Java Pattern.quote()'s Literal String and Regex's?

I have been altering urls inputted to my web app into strings that play nice with Java regex's.

For example the mock url:

http://ift.tt/29XwOJ9

would become

^.*http://ift.tt/29Xcfs8

for Pattern matching sake. (In the Java code obviously there would be double escape back slashes)

Curious what the performance difference with using Java's Pattern.quote("string") to create a String Literal? Will there be any unanticipated changes in functionality when performing a Pattern.matcher operation?

Thanks for your input! -Ray

Aucun commentaire:

Enregistrer un commentaire