Answer the question
In order to leave comments, you need to log in
How to remove all comments from a string using regular expressions in php?
Hello!
I'm learning regular expressions.
Decided to remove multi-line comments from the string - /* blah blah blah */
Compiled the wrong regular expression - /(\*).*(\*)/
Now he is looking for the first and last occurrences * and deletes everything between them
And he does not care what else is there a bunch * in the piece that he demolished (
Well, it remains //
Cant on the jamb, help the crooked hand :)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question