0

Iam looking to way to find and replace multiple occurances of opening <table > tag using regex

tag have different patterns between <> and need to select only characters within opening tag - not between

<table i need to select this> i dont want select this one </table>

no language specified - i need to replace whole content opening table tag to <table class="table-responsive"> in sql file

Chris
  • 1
  • 2
  • 1
    [Don't parse HTML with regex](http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454). – Jonathon Reinhart Oct 09 '16 at 21:46
  • Why is there HTML in an SQL file? – 4castle Oct 09 '16 at 21:53
  • it was products export from PrestaShop where person who put the product description didn't know how to make bootstrap tables – Chris Oct 09 '16 at 22:00
  • 1
    @JonathonReinhart .. [unless you know what you are going to do.](http://stackoverflow.com/a/4234491/1020526) – revo Oct 09 '16 at 22:11

1 Answers1

1

If this is a one-off replacement, regex will be fine. As long as there are not > inside the attributes of the opening tag, you can use this to select opening tags:

<table[^>]*>
4castle
  • 28,713
  • 8
  • 60
  • 94