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

136
Views
How to Get Specific text from string address using regular expression?

I have been trying to extract the 'XYZ Name' from this address:

*Address: *

XYZ Name
X Address
Y Address
Z Address

if we have an address like this:

Address:
XYZ Name
X Address
Y Address
Z Address

then we can use the following regular expression to get Address and XYZ Name:

var myRegex1 = /Address\s*.*/mi;
var bracket2 = myRegex2.exec(msgBody);

But due to the changed format of Address to *Address: *, this regular expression doesn't work anymore. Any suggestion would be much appreciated.

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

0

So from the regular expression provided by @Gurmanjot Singh, I was able to extract the required text mentioned in the question. So following snippet can be used for that:

var myRegex2 = / *\*?Address\s*\*?\s*(.+)/g;
var bracket2 = myRegex2.exec(msgBody); 
Logger.log(bracket2[bracket2.length-1]);
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!