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 grooving and shortening of arrays?
What are the functions that can be performed using cgi program?
what is CPAN?
What are the options that can be used to avoid logic errors in perl?
“The methods defined in the parent class will always override the methods defined in the base class”. What does this statement means?
How to determine strings length in perl?
what is Perl one liner?
What is posix in perl?
How to turn on Perl warnings? Why is that important?
What are the logical operators used for small scale operations? Explain them briefly.
If EXPR is an arbitrary expression, what is the difference between $Foo::{EXPR} and *{"Foo::".EXPR}?
Why we use CGI?
how to get back up from private character editor which is saved in the format of .udf
Explain the difference between "my" and "local" variable scope declarations. ?
What does length(%HASH) produce if you have thirty-seven random keys in a newly created hash?