Skip to content

A local-first personal finance app

🐛 Fix iphone 13 unable to use regex lookbehinds (#3823)

Michael Clarkdd69e539d3ec
diff --git a/packages/loot-core/src/server/accounts/transaction-rules.ts b/packages/loot-core/src/server/accounts/transaction-rules.ts
index 3f952dcece..d32eb9324f 100644
--- a/packages/loot-core/src/server/accounts/transaction-rules.ts
+++ b/packages/loot-core/src/server/accounts/transaction-rules.ts
@@ -462,9 +462,19 @@ export function conditionsToAQL(conditions, { recurDateBounds = 100 } = {}) {
return { $or: values.map(v => apply(field, '$eq', v)) };
case 'hasTags':
- const tagValues = value
- .split(/(?<!#)(#[\w\d\p{Emoji}-]+)(?=\s|$)/gu)
- .filter(tag => tag.startsWith('#'));
+ const words = value.split(/\s+/);
+ const tagValues = [];
+ words.forEach(word => {
+ const startsWithHash = word.startsWith('#');
+ const containsMultipleHash = word.slice(1).includes('#');
+ const correctlyFormatted = word.match(/#[\w\d\p{Emoji}-]+/gu);
+ const validHashtag =
+ startsWithHash && !containsMultipleHash && correctlyFormatted;
+
+ if (validHashtag) {
+ tagValues.push(word);
+ }
+ });
return {
$and: tagValues.map(v => {
diff --git a/upcoming-release-notes/3823.md b/upcoming-release-notes/3823.md
new file mode 100644
index 0000000000..ee79dbc1cb
--- /dev/null
+++ b/upcoming-release-notes/3823.md
@@ -0,0 +1,6 @@
+---
+category: Bugfix
+authors: [MikesGlitch]
+---
+
+Fix Iphone 13 error when attempting to view budget.