Skip to content

Commit

Permalink
Fix regex for MySQL and PostgreSQL connection URL
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumebort committed Aug 20, 2011
1 parent c0df25e commit 6d7bdf0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions framework/src/play/db/DBPlugin.java
Expand Up @@ -204,7 +204,7 @@ private static boolean changed() {
p.put("db.destroyMethod", "close");
}

Matcher m = new jregex.Pattern("^mysql:(//)?(({user}[\\w]+)(:({pwd}[^@]+))?@)?(({host}[^/]+)/)?({name}[\\w]+)$").matcher(p.getProperty("db", ""));
Matcher m = new jregex.Pattern("^mysql:(//)?(({user}[a-zA-Z0-9_]+)(:({pwd}[^@]+))?@)?(({host}[^/]+)/)?({name}[^\\s]+)$").matcher(p.getProperty("db", ""));
if (m.matches()) {
String user = m.group("user");
String password = m.group("pwd");
Expand All @@ -220,7 +220,7 @@ private static boolean changed() {
}
}

m = new jregex.Pattern("^postgres:(//)?(({user}[\\w]+)(:({pwd}[^@]+))?@)?(({host}[^/]+)/)?({name}[\\w]+)$").matcher(p.getProperty("db", ""));
m = new jregex.Pattern("^postgres:(//)?(({user}[a-zA-Z0-9_]+)(:({pwd}[^@]+))?@)?(({host}[^/]+)/)?({name}[^\\s]+)$").matcher(p.getProperty("db", ""));
if (m.matches()) {
String user = m.group("user");
String password = m.group("pwd");
Expand Down

0 comments on commit 6d7bdf0

Please sign in to comment.