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

160
Views
Regex with double asterisk javascript

I need two regular expressions, one to get ** at the beginning of a string, and one at the end.

For example:

This is a **text** test

With an expression obtain the ** of the beginning and with another those of the end. There may be many more repetitions.

I have tried the following:

(\*\*)
^(\*\*)
/\*\*/
^/\*\*/

Thanks a lot

This **would** be a good **text** to do some **testing**

It should mark all the words that contain ** at the beginning. And with the other you should mark all the ones that end with **

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

To match ** just before a word use:

\B\*\*\b
  • \B - is inverse of \b. It matches where \b doesn't
  • \b - asserts position at a word boundary i.e. (^\w|\w$|\W\w|\w\W)

RegEx Demo 1

And to match ** just after a word use:

\b\*\*\B

RegEx Demo 2

about 4 years ago · Santiago Trujillo Report

0

if I understand correctly:

  • (\*\*)(?=[^\s]*\*\*) -> obtain the ** at the beginning of the word
  • (?<=[^\s])(\*\*) -> obtain the ** at the end of the word
about 4 years ago · Santiago Trujillo Report

0

\*\*\w and \w\*\* (works in editpadlite at least) or \*\*(?=[a-zA-Z$\r]) and (?<=[a-zA-Z\r^])(\*\*)

about 4 years ago · Santiago Trujillo 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!