Write a script for 'count the no.of digits using regular
expressions in perl..
Answer Posted / tclgeek
to find the count of no of digits using regular expression in TCL
set val "abbj68689kbj8798797"
set a [regexp {[a-z]+(\d+)[a-z]+(\d+)} $val val1 val2 val3]
if { $a == 1 } {
puts "matched pattern found are : $val2$val3"
puts "the number of digits are [expr [string length $val2] + [string length $val3]]"
} else {
puts "error"
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain returning values from subroutines?
What are different data types that perl supports. Elaborate on them.
Define operators used in perl?
What is -> symbol in perl?
What is the syntax used in Perl grep function?
What are the functions that can be performed using cgi program?
What are the purpose of close(), getc() and read() functions?
What is automatic error handling in perl?
Explain regular expression in perl?
Why we use CGI?
what is Polymorphism in Perl?
What is hash?
What does Perl do if you try to exploit the execve(2) race involving setuid scripts?
Write a cgi program to show the header part?
Explain different types of perl operators.