Fix issue 442 - Only use older group method

This commit is contained in:
Ulrich K 2022-11-13 13:43:18 +01:00
parent 8e5685aad2
commit b4b042b401

View file

@ -718,7 +718,8 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
* @return {@link TextWatcher}
*/
public TextWatcher initializeTextWatcher(ComposeAdapter.ComposeViewHolder holder) {
String pattern = "(.|\\s)*(?<mention>@[\\w_-]+@[a-z0-9.\\-]+|@[\\w_-]+)";
String pattern = "(.|\\s)*(@[\\w_-]+@[a-z0-9.\\-]+|@[\\w_-]+)";
int mentionPatternGroupNumber = 2; // must match expression above
final Pattern mentionPattern = Pattern.compile(pattern);
String patternTag = "^(.|\\s)*(#([\\w-]{2,}))$";
@ -884,7 +885,7 @@ public class ComposeAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder
matcherTag = tagPattern.matcher(searchIn);
matcherEmoji = emojiPattern.matcher(searchIn);
if (matcherMention.matches()) {
String searchGroup = matcherMention.group("mention");
String searchGroup = matcherMention.group(mentionPatternGroupNumber);
accountsVM.searchAccounts(BaseMainActivity.currentInstance, BaseMainActivity.currentToken, searchGroup, 10, true, false).observe((LifecycleOwner) context, accounts -> {
if (accounts == null) {
return;