diff --git a/__tests__/ExpensiMark-HTML-test.js b/__tests__/ExpensiMark-HTML-test.js
index ab3cd854..f514229e 100644
--- a/__tests__/ExpensiMark-HTML-test.js
+++ b/__tests__/ExpensiMark-HTML-test.js
@@ -389,7 +389,8 @@ test('Test critical markdown style links', () => {
'[link with [brackets] inside of it](https://google.com) ' +
'[link with smart quotes ‘’“”](https://google.com) ' +
'[link with someone@expensify.com email in it](https://google.com)' +
- '[Localhost](http://a:3030)';
+ '[Localhost](http://a:3030)' +
+ '[ name with rear spaces ](https://example.com)';
const resultString =
'Testing ' +
'strikethrough bold italic ' +
@@ -407,7 +408,8 @@ test('Test critical markdown style links', () => {
'link with [brackets] inside of it ' +
'link with smart quotes ‘’“” ' +
'link with someone@expensify.com email in it' +
- 'Localhost';
+ 'Localhost' +
+ ' name with rear spaces ';
expect(parser.replace(testString)).toBe(resultString);
});
@@ -1032,7 +1034,7 @@ test('Test markdown and url links with inconsistent starting and closing parens'
'[Text text] more text (link [square brackets within] here)' +
'[Text text] more text (link (parenthesis within) here)' +
'[Text text] more text link here' +
- '[Text text] more text (link here)' +
+ '[Text text] more text (link here )' +
'[Text text] more text ((link here))' +
'[Text text] more text [(link here)]' +
'[Text text] more text (link here)[Text text] more text (link here)';
@@ -2270,7 +2272,7 @@ describe('room mentions', () => {
test('room mention with space inside link should not be rendered', () => {
const testString = '[ #room](google.com/sub#111)';
- const resultString = '#room';
+ const resultString = ' #room';
expect(parser.replace(testString)).toBe(resultString);
});
diff --git a/lib/ExpensiMark.ts b/lib/ExpensiMark.ts
index 34b437ed..9b63f4bb 100644
--- a/lib/ExpensiMark.ts
+++ b/lib/ExpensiMark.ts
@@ -261,13 +261,13 @@ export default class ExpensiMark {
if (!g1.trim()) {
return match;
}
- return `${g1.trim()}`;
+ return `${g1}`;
},
rawInputReplacement: (_extras, match, g1, g2) => {
if (!g1.trim()) {
return match;
}
- return `${g1.trim()}`;
+ return `${g1}`;
},
},
@@ -298,10 +298,9 @@ export default class ExpensiMark {
{
name: 'reportMentions',
- regex: /(?|<\/code>))/gimu,
- replacement: '$1',
+ regex: /(?|<\/code>|<\/a>))/gimu,
+ replacement: '$1'
},
-
/**
* This regex matches a valid user mention in a string.
* A user mention is a string that starts with the '@' symbol and is followed by a valid user's primary