matching - how to match in perl using \d? -


just stupid question - meaning of d in following code. role playing in it?

$str = 'telephone: 040-27614396'; $str =~ m/telephone:\s*(\d{3}-\d{8})$/; 

please tell meaning of these kind of stuff

if (/^\#/) 

the expression checking if string variable $str matches regular expression /telephone:\s*(\d{3}-\d{8})$/.

look here more details on perl expression matching:

http://www.tutorialspoint.com/perl/perl_regular_expressions.htm

the link discusses:

  • \d: matches digits. equivalent [0-9].
  • ^: matches beginning of line.
  • \: "escapes" following character: "#" means treat "#" "#" ... instead of trying interpret metacharacter.

there many tutorials "regular expressions" on web can explain in more depth.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -