0

I am trying to find all <br> instances in the following string, but only in the "categories" class:

<td>bla<br>bla</td><td class="categories">cat1<br>cat2<br>cat3</td>

I am realy new to regex, and this is what I tried so far, but it only finds the first <br> after cat1 and takes the whole part in front of it in the result as well...

(?>categories">).*?<br>

EDIT: I want to find all <br> occurences to replace them with a comma. For the moment I'm using a text editor (Sublime Text) to achieve this...

Cœur
  • 37,241
  • 25
  • 195
  • 267
intrixius
  • 1,096
  • 2
  • 11
  • 25

1 Answers1

1

Why would you want to use regex? What are you trying to validate?

http://en.wikipedia.org/wiki/Regular_expression

If you want to find html elements using class variables then you want to look into javascript or jquery

http://api.jquery.com/class-selector/

Hope that helps a bit

Chris
  • 805
  • 6
  • 19