-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Followup to 2663 Regexformatter #3096
Conversation
…title with capitalize and title case
Optional<Formatter> formatter; | ||
|
||
if (modifier.matches("regex.*")) { | ||
String regex = modifier.substring(5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please define this magic number somewhere as constant
public static void setRegex(String rex) { | ||
// formatting is like ("exp1","exp2"), we want to remove (" and ") | ||
String rexToSet = rex; | ||
rexToSet = rexToSet.substring(2, rexToSet.length() - 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please define this magic number as constant with a useful name, so it is clear what it does
@@ -950,6 +952,8 @@ Reference_library=Referencelibrary | |||
|
|||
Refine_supergroup\:_When_selected,_view_entries_contained_in_both_this_group_and_its_supergroup=Undergruppe\:_Vis_poster_indeholdt_både_i_denne_gruppe_og_gruppe_over | |||
|
|||
Regex= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regex is the same as regular expression, I would reuse that existing translation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments regarding the constants. Then it is good to go.
@@ -65,6 +65,8 @@ | |||
|
|||
public static final List<Formatter> ALL = new ArrayList<>(); | |||
|
|||
private static final int LENGTH_OF_REGEX_PREFIX = 5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can 5
be replaced by `"regex".length()``?
@@ -87,7 +90,7 @@ public String getExampleInput() { | |||
public static void setRegex(String rex) { | |||
// formatting is like ("exp1","exp2"), we want to remove (" and ") | |||
String rexToSet = rex; | |||
rexToSet = rexToSet.substring(2, rexToSet.length() - 2); | |||
rexToSet = rexToSet.substring(REMOVE_OUTER_QUOTES, rexToSet.length() - REMOVE_OUTER_QUOTES); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would replace the first REMOVE_OUTER_QUOTES
by "\"(".length()
and the second one by ")\"".length()
. Maybe as two variables LENGTH_OF_QUOTE_AND_OPENING_BRACE
and LENGTH_OF_CLOSING_BRACE_AND_QUOTE
.
The Regexformatter now handles protected groups correctly. This is a followup to #2663. There, the regex modifier was introduced and a minor issue with shorttitle was fixes
gradle localizationUpdate
?