In JavaScript you can use only /
as a delimiter (or '
or "
when you're using new Regex()
constructor).
Example JS:
/Hello, (\w+)/ig.test('Hello, John');
new RegExp('Hello, (\w+)', 'ig').test('Hello, John');
In PHP, however, you can use /
or #
or %
or +
or ~
, as well as pair of the following brackets: []
, <>
, {}
, ()
.
Example PHP:
preg_match('/Hello, (\w+)/', 'Hello, John')
preg_match('#Hello, (\w+)#', 'Hello, John')
preg_match('[Hello, (\w+)]', 'Hello, John')
The problem is, only slash-char /
is recognized by QuickDocs. If I would like my patterns to be recognizable I'm forced to change all #
by /
, which in some cases isn't quickly possible.