Skip to content

Commit

Permalink
Merge pull request #645 from FitseTLT/add-support-for-phone-mention-w…
Browse files Browse the repository at this point in the history
…ithout-sms-suffix

Added support for phone mention without `expensify.sms` suffix
  • Loading branch information
deetergp authored Feb 8, 2024
2 parents c85dc9b + c0d4a94 commit 7aa1d42
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/CONST.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ export declare const CONST: {
* Regex matching an text containing an email
*/
readonly EMAIL_PART: "([\\w\\-\\+\\'#]+(?:\\.[\\w\\-\\'\\+]+)*@(?:[\\w\\-]+\\.)+[a-z]{2,})";
/**
* Regex matching a text containing an e164 format phone number
*/
readonly PHONE_PART: "\\+?[1-9]\\d{1,14}";
/**
* Regular expression to check that a basic name is valid
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/ExpensiMark.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default class ExpensiMark {
*/
{
name: 'userMentions',
regex: new RegExp(`(@here|[a-zA-Z0-9.!$%&+=?^\`{|}-]?)(@${CONST.REG_EXP.EMAIL_PART})(?!((?:(?!<a).)+)?<\\/a>|[^<]*(<\\/pre>|<\\/code>))`, 'gim'),
regex: new RegExp(`(@here|[a-zA-Z0-9.!$%&+=?^\`{|}-]?)(@${CONST.REG_EXP.EMAIL_PART}|@${CONST.REG_EXP.PHONE_PART})(?!((?:(?!<a).)+)?<\\/a>|[^<]*(<\\/pre>|<\\/code>))`, 'gim'),
replacement: (match, g1, g2) => {
if (!Str.isValidMention(match)) {
return match;
Expand Down

0 comments on commit 7aa1d42

Please sign in to comment.