Regular Expressions anyone?

Log in to stop seeing adverts

Status
Not open for further replies.

Joe_Fox

Well-Known Member
Anyone any good at using regular expressions to find certain stuff in some code?

I want to find all occurences of where a </div> tag is followed by another </div> tag.

The second </div> tag can be right next to the first, on the next line or even separated from the first tag by white space.

If there is anything inbetween the two </div> tags then this should not be counted.

For example:

These files should be matched:

1.
Code:
</div></div>
2.
Code:
</div> </div>
3.
Code:
</div>
        </div>

These files should NOT be matched:

1.
Code:
</div>some text</div>
2.
Code:
</div>some text </div>
3.
Code:
</div>some text
         </div>

If anyone can provide me with a regular expression that I can use to search through my files of code to find all as explained above I'll be eternally grateful.

Cheers,
Joe
 
still not matching example 3 of the SHOULD match examples, thanks though.
 
sorry .*</div>[ \n]*</div> will

edit: there is a white space before the \n
 
Last edited:
Status
Not open for further replies.
Log in to stop seeing adverts

Championship

P Pld Pts
1Leicester4697
2Ipswich4696
3Leeds Utd4690
4Southampton4687
5West Brom4675
6Norwich City4673
7Hull City4670
8Middlesbro4669
9Coventry City4664
10Preston 4663
11Bristol City4662
12Cardiff City4662
13Millwall4659
14Swansea City4657
15Watford4656
16Sunderland4656
17Stoke City4656
18QPR4656
19Blackburn 4653
20Sheffield W4653
21Plymouth 4651
22Birmingham4650
23Huddersfield4645
24Rotherham Utd4627
Top