4
4
4eloBek2015-08-31 13:47:46
JavaScript
4eloBek, 2015-08-31 13:47:46

How to pull out only url replace'om?

Replace again O_o
There is, for example, a link:

<a href="http://google.com" style="text-decoration: none; font-weight: bold; font-family: Georgia, serif, sans-serif; font-size: 20px">Hello world</a>

I'm trying to pull out 2 parameters: href=" google.com " and Hello world
replace(/<a.*?(href\s*=\s*["|'][^]*["|']).*?>([^]*)<\/a>/gim, '$2 и $1');

Without style , everything was fine, but if it is present, it is displayed along with a link of $1.
Tell me how to avoid this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Sergey, 2015-08-31
@4eloBek

Long to explain, here is the regular season. And the groups in it.
and pull out $1 and $3.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question