Forum Moderators: open

Message Too Old, No Replies

Replacement Problem

How to make multiple replacements

         

jv72

1:20 pm on May 3, 2022 (gmt 0)

Top Contributors Of The Month



I didn't find a suitable category for this post.

Is there any way or program to solve this kind of replacement. I have the text file which contains:


<strong>Car</strong><br><a href="https://www.google.fi/search?q=&amp"></a> 

<strong>House</strong><br><a href="https://www.google.fi/search?q=&amp"></a>

<strong>Lady</strong><br><a href="https://www.google.fi/search?q=&amp"></a>


After replacement text should look like this:


<strong>Car</strong><br><a href="https://www.google.fi/search?q=Car&amp"></a>

<strong>House</strong><br><a href="https://www.google.fi/search?q=House&amp"></a>

<strong>Lady</strong><br><a href="https://www.google.fi/search?q=Lady&amp"></a>



Is it possible to make all replacements AT ONCE? And how?

I know I have to use FOR/NEXT or DO WHILE/ENDDO loop but I don't know how.

I use Notepad++, but I can use any other program if I can solve this problem.

Thanks if you can help.


[edited by: not2easy at 1:52 pm (utc) on May 3, 2022]
[edit reason] added code tags [/edit]

lucy24

3:13 pm on May 3, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What language is it in? This is the javascript/ajax subforum, so conjecturally javascript, but let's make sure. What does the script currently look like?

If javascript, why does it need to be any kind of loop? Seems like
blahblah.replace(/oldpattern/g, "newpattern")
would do it.