R
R
Rostislav Ignatenko2018-02-27 05:02:14
PHP
Rostislav Ignatenko, 2018-02-27 05:02:14

How to change the regular expression?

There is a regular expression. It will remove tags and their attributes. How to correct it correctly so that it does not delete, let's say the title = "Test" tag has it?
'#</?'.$tag.'[^>]*>'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2018-02-27
@Stalker_RED

You have a problem. You decide to use regular expressions to solve it.
Now you have two problems.

- Doctor, when I do this, it hurts...
- Don't do this.

Seriously, regular expressions are not for that. It would be correct not to correct this expression, but to throw it out entirely.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question