-1

I want a regex for the following string:

For more:  [Click here](https://www.google.ca) and [click me](https://www.google.com)

For that My current regex is as follows.

/\[.*\]\((((https?\:\/\/)|(www\.))(\S+))/ig

Give me the regex with that I can find two different links in the same line.

Right now I am finding 1 combined regex for both of them.

Siddharth Thakor
  • 156
  • 3
  • 17

1 Answers1

1

My guess is that we have URLs in (), which we can use an expression similar to, if that'd be the case:

\((https?[^\s]+)\)

with a capturing group, where our desired outputs are.

Demo 1

For capturing the [], we would just expand our expression:

(\[.+?])\((https?[^\s]+)\)      //$ sign removed

Demo 2

Siddharth Thakor
  • 156
  • 3
  • 17
Emma
  • 27,428
  • 11
  • 44
  • 69