Questions related to Regular Expression's quotemeta(`\Q...\E`). Use in conjunction with flavour of Regex(eg:re2) used and the tool it is used in (eg:Javascript,c++).
Questions tagged [quotemeta]
5 questions
23
votes
3 answers
Javascript equivalent of Perl's \Q ... \E or quotemeta()
In Perl regular expressions, you can surround a subexpression with \Q and \E to indicate that you want that subexpression to be matched as a literal string even if there are metacharacters in there. You also have the quotemeta function that inserts…

zwol
- 135,547
- 38
- 252
- 361
10
votes
2 answers
Escaping metacharacters in a Raku regex (like Perl's quotemeta() or \Q...\E)?
How can I escape metacharacters in a Raku regex the way I would with Perl's quotemeta function (\Q..\E)?
That is, the Perl code
my $sentence = 'The quick brown fox jumped over the lazy dog';
my $substring = 'quick.*?fox';
$sentence =~…

codesections
- 8,900
- 16
- 50
2
votes
2 answers
Implementing "quotemeta" \Q ... \E in Tcl?
The typical use-case is when a regex needs to include user input. Characters with special meaning in regex (i.e. "the dirty dozen" in Perl) need to be escaped. Perl provides the "quotemeta" functionality to do this: simply encapsulate…

Andrew Cheong
- 29,362
- 15
- 90
- 145
1
vote
1 answer
Perl - quotemeta with Chinese characters
I use quotemeta to escape for file path of Chinese filename. But it returns wrong.
Example of the code:
#!/usr/bin/perl
use Encode;
my $ustring1 = "/opt/游戏美术.txt";
my $ustring2 = quotemeta $ustring1;
print "$ustring1\n" ;
print "$ustring2";
print…

Diamond
- 175
- 1
- 2
- 14
0
votes
2 answers
Strings with quotemeta enabled not able to match specific regex
For following strings with quotemeta enabled, the if statements are not able to match .cpp and .o file names. Am I doing anything wrong…

user3392184
- 13
- 6