L
L
lexinti2020-03-02 18:00:33
Regular Expressions
lexinti, 2020-03-02 18:00:33

How to use regexp to replace 5 found element and not all?

I need to insert links on pages on many sites, and I want to automatically insert my link after every fifth " " on the page using regular expressions (that is, insert one link on the page that will go after 5 found by the regular expression " "). I was told that with the help of regular expressions this is possible. Can you help in this matter? </a></a>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Pankov, 2020-03-02
@trapwalker

Replace: (.*?</a>){5}
To:$0<a href="url_here">text</a>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question