fix: update mention room regex#840
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
I have read the CLA Document and I hereby sign the CLA |
|
@rayane-d I just added and updated the test |
|
@rayane-d Our current PR applies the mention report logic to all test('Test for inline code block with triple backtick with spaces as content', () => {
const testString = '``` ```';
const resultString = '``<code> </code>``';
expect(parser.replace(testString)).toBe(resultString);
});In this case, the parser mistakenly treats parts of the encoded backticks as mentionable content (e.g. #x60), which breaks valid syntax highlighting and markdown rendering. Do you think we should narrow the scope of the PR? |
|
@rayane-d Thanks! I'm currently working on it and testing a few cases. |
|
@rayane-d I applied the new regex: It resolves the issue with encoded strings, but the bug still occurs in other cases:
You can pull this PR and run |
|
@truph01 I think this is happening because we're allowing any character before |
|
@rayane-d Just to confirm—you're referring to special characters like Even if we limit the changes in this PR strictly to those characters, I still see a risk of regression. For example, we could reintroduce issues like the one I mentioned earlier with |
Yes, that is correct.
I believe we can test them individually to ensure there are no regressions and eliminate the ones that cause issues, such as |
|
@rayane-d I'm currently working on this, and the target characters we're focusing on are: That said, I’d like to highlight a related bug discussed here: #840 (comment). In that case, a string like Although our current logic already prevents matching room mentions with alphabetic characters, it doesn't account for cases like It will lead to the high risk of regression. Could you share your thoughts on my concern? |
|
@rayane-d PR is updated |
|
@puneetlath Could you please approve the workflows so they can run? |
|
Triggered. |
|
@puneetlath all yours! |



This PR fixes an issue where the regex for room mentions (
#room-name) was not matching case when the#symbol was preceded by:characterFixed Issues
Expensify/App#57195
Tests
#test-roomstring matches the room name if the string is::#test-roomTest steps:
Screen.Recording.2025-03-19.at.12.59.01.mov
QA
What does QA need to do to validate your changes?
What areas to they need to test for regressions?