mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-24 01:32:16 -05:00
precompile user id pattern
This commit is contained in:
parent
f29d3015b8
commit
c2013c9ca8
@ -42,6 +42,8 @@ import android.content.Context;
|
|||||||
|
|
||||||
public class PgpKeyHelper {
|
public class PgpKeyHelper {
|
||||||
|
|
||||||
|
private static final Pattern USER_ID_PATTERN = Pattern.compile("^(.*?)(?: \\((.*)\\))?(?: <(.*)>)?$");
|
||||||
|
|
||||||
public static Date getCreationDate(PGPPublicKey key) {
|
public static Date getCreationDate(PGPPublicKey key) {
|
||||||
return key.getCreationTime();
|
return key.getCreationTime();
|
||||||
}
|
}
|
||||||
@ -540,8 +542,7 @@ public class PgpKeyHelper {
|
|||||||
* "Max Mustermann (this is a comment)"
|
* "Max Mustermann (this is a comment)"
|
||||||
* "Max Mustermann [this is nothing]"
|
* "Max Mustermann [this is nothing]"
|
||||||
*/
|
*/
|
||||||
Pattern withComment = Pattern.compile("^(.*?)(?: \\((.*)\\))?(?: <(.*)>)?$");
|
Matcher matcher = USER_ID_PATTERN.matcher(userId);
|
||||||
Matcher matcher = withComment.matcher(userId);
|
|
||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
result[0] = matcher.group(1);
|
result[0] = matcher.group(1);
|
||||||
result[1] = matcher.group(3);
|
result[1] = matcher.group(3);
|
||||||
|
Loading…
Reference in New Issue
Block a user