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
What is the use of -w, -t and strict in Perl?
What does delete function do in perl?
When do you use perl programming?
Differentiate use and require?
Explain perl. When do you use perl for programming? What are the advantages of programming in perl?
Create a function that is only available inside the scope where it is defined ?
How can you replace the characters from a string and save the number of replacements?
Explain which feature of PERL provides code reusability?
What are perl variables?
What is stdin in perl?
How to implement a stack in Perl?
how to connect cisco switch uisng perl script
Explain string comparison operators in perl.
what are the strategies followed for multiple form interaction in cgi programs?
What is -> symbol in perl?