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


Please Help Members By Posting Answers For Below Questions

What exactly is grooving and shortening of the array?

592


what is Polymorphism in Perl?

537


How do I print the entire contents of an array with Perl?

528


Write a program to decode the data in the form using cgi programming

541


Which feature of perl provides code reusability?

569






You want to print the contents of an entire array. How would you do that?

521


Difference between the variables in which chomp function work ?

603


Explain subroutine?

525


You want to empty an array. How would you do that?

473


What is a chomp() function in perl?

513


Explain the internal working of cgi

505


Define print() function in perl?

553


List the prefix dereferencer in Perl.

565


Why do we use "use strict" in perl?

528


Explain lexical variables.

515