Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

211
Views
Text expander paste function to format a phone number

I am trying to create a Text Expander snippet to speed up a workflow. I want to copy a number in this format: +12345678910 and be able to past this it like this: (234) 567-8910 and make the font bold.

The closest script I've found is:

var s2 = (""+TextExpander.pasteboardText).replace(/\D/g, '');
var m = s2.match(/^(\d{3})(\d{3})(\d{4})$/);
if(m) `(${m[1]}) ${m[2]}-${m[3]}`;
else "";

This allows me to copy the "2345678910" portion of the data and and have it pasted as (234) 567-8910. Any suggestions would be super helpful, I'm interested in learning.

thanks

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Add the +1 to your regex, but don't include it in a group: /^\+1(\d{3})(\d{3})(\d{4})$/

regexer can be super helpful for flushing these issues out~

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!