M
M
Maxim Makhnyuk2012-01-22 22:43:08
PHP
Maxim Makhnyuk, 2012-01-22 22:43:08

Comments in regular expressions (PHP)?

For regular expressions, it is possible to define comments: "/(?#comment)/".
And how to write this comment correctly when the regular expression is written like this:
"#(?#comment)#"?
The # symbol is convenient to use when parsing URLs often and a lot, so as
not to escape each /.
Thanks in advance for answering this possibly stupid question. It’s just that either Google doesn’t know, or I couldn’t explain to him normally what I need.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Melkij, 2012-01-22
@melkij

Use a different delimiter character. Few of them, right?
@~!%

S
Sekira, 2012-01-22
@Sekira

1) "#(\?\#comment)#"
2) "'(\?#comment)'" (there is a single quote inside, instead of # => " ' ' ")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question