0

I have to do a regex to spin the content. I already have a REGEX that works very well on nested spin :

{([^{}]+?)}

Unfortunately in my source code, I also have CSS code that matches because of the braces.

Like this (there can be several style tags):

<style>
#test a{
color:red;
font-size:13px;
font-family:Arial;
}
</style>

Therefore I need to exclude all these styles tag and spin content with a single REGEX.

Any ideas? In advance thank you

  • What is spintax for those that don't know? Could you add some examples. Oh and can you include your regex code with inputs, your output and desired outputs. – Progrock Oct 29 '20 at 11:08
  • Use DOMDocument to only select content that isn't in style tags (or in script tags if any). – Casimir et Hippolyte Oct 29 '20 at 11:42
  • Note also that using a non-greedy quantifier in your pattern is useless (and slower) since curly brackets are excluded from your character class. – Casimir et Hippolyte Oct 29 '20 at 11:44
  • Spintax is Spinning content . DomDocument raises quite a lot of errors if there is any problem in the HTML – Piskorski Aurélien Oct 29 '20 at 14:25
  • @Pisk Please show a [mcve]. We may be able to help you with the errors that DomDocument is raising. Until this question is edited, it is unfortunately incomplete and may be closed as Unclear. – mickmackusa Dec 21 '20 at 01:12

0 Answers0