Multiline regex find third div in div group

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Multiline regex find third div in div group



How can I write a regular expression to find the third div class name in a group div? So in the instance below, I'd like to find clsA3


<div class="clsA">
<div class=clsA1">blah</div>
<div class=clsA2">blah</div>
<div class=clsA3">blah</div>
</div>



I'm trying to use Visual Studio 2013 Search and Replace using Regular Expression option. The purpose of this task is one-time maintenance task.





You mean this regex101.com/r/rX5eE5/4 ?
– Avinash Raj
Dec 10 '14 at 18:57




1 Answer
1



Works with VS2010. Not sure if VS2013 does normal regex yet.



Find:


<div class=[^>]*>[ n]*(<div class=[^>]*>[^<]*</div>[ n]*)^2<div class="@[^">]+"@>[^<]*</div>[ n]*</div>



Replace:


1Hello World2



Output:


<div class="clsA">
<div class=clsA1">blah</div>
<div class=clsA2">blah</div>
<div class=Hello World">blah</div>
</div>





VS2013 does normal regex yet If I remember correctly, starting from VS 2012, it uses .NET's Regex.
– JohnyL
Aug 12 at 17:50







By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard