Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does \D do in Perl regular expressions

Tags:

regex

perl

In some code I am maintaining, I have found the expression:

$r->{DISPLAY} =~ s/\Device//s;

What surprises me is that it matches both device and Device!

I have not found any mention of \D in the documentation, only \d.

Can someone clarify please...

like image 436
Roger Avatar asked Jun 20 '11 12:06

Roger


1 Answers

\D is the negation of \d, i.e. it matches anything that is not a digit.

like image 120
sepp2k Avatar answered Nov 15 '22 21:11

sepp2k