I have a file with a tons of links of 2 formats as follows: A. <a href="http://www.ouathuygbbaaarrvg.com" target="_blank">Doggy</a> B. <a href="http://www.cehaiuragityagtay.com">Catty</a> I want to search those links of type B, but don't know how. <a href="http.*?"> identifies both A and B as the * searches all the way, but I want the * to last until it encounters "
<a href="htt[^"][^"]*?"> This does work to nail down the type B links. Now, if I wanna add [target="_blank"] to the back of those B links, Find and Replace will simply paste the regex, how should that be done?
Depends on the language. With regex you could use parameters to catch the string, if your library supports it. You could also catch the substring index/length and use some Mid function to get the string. A very simple solution if you don't want to program it would be to use sed to preprocess. Sed can extract and transform most simple cases.