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

263
Views
How to parse specific words after text?

The text I would like to parse always comes in the following pattern:

"Your $22.12 transaction with Amazon.com"

I would like to parse all text after "transaction with " which would be the name of company/store.

Can anybody help with this? Thank you so much!


This question does not have a relevant enough answer here : Javascript Regexp - Match Characters after a certain phrase That question is about matching characters after a fixed, exact, constant phrase. The phrase in this question contains a substring (the $ amount) that varies. An answer should explain, in addition to how to get characters after text, how to match a dollar money amount with RegEx.

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

0

This Regular Expression may work:

Your \$\d+\.\d{2} transaction with (.*)

Just make a regex that matches the beginning phrase followed by (.*).

\d matches any digit character from 0 to 9.

The plus sign + matches 1 or more of what precedes it. \d+ matches 1 or more digits.

{2} matches exactly 2 of something. \d{2} matches 2 digits.

. matches any character. * matches zero or more of what comes before it. So Regex .* matches any number of any character, greedily. Wrapping .* in parentheses creates a capture group that lets you get the matched text after running the regex on it.

const txt = 'Your $22.12 transaction with Amazon.com'
const regEx = /Your \$\d+\.\d{2} transaction with (.*)/
const matches = txt.match(regEx)
document.write(matches[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!