Gossamer Forum
Home : General : Perl Programming :

Regular Expression for Placeholder Bind values

Quote Reply
Regular Expression for Placeholder Bind values
 
Hi All..

How can i find the number of placeholder bind value occurances in a given query using regular expressions?

for example
: if the query is like ..
select * from EMP where EMPNO='&eno' and DEPTNO='&dno' --- [ it contains 2 occurances of bind values ]
select * from EMP where EMPNO='&eno' --- [ it contains 1 occurance of bind value ]

so the regular expression should return the count of occurances.

Could anyone help me out in this regard ?

Thanks in advance.

Warm Regards,
Saravanan
Quote Reply
Re: [slg_saravanan] Regular Expression for Placeholder Bind values In reply to
Hi,

This should work

my @c = $query =~ /('&[^']*')/g;

print "Count of accurrenaces: " . ($#c+1);

Cheers,

Cheers,

Dat

Programming and creating plugins and templates
Blog