Gossamer Forum
Home : Products : DBMan : Customization :

Reg Expression help

Quote Reply
Reg Expression help
What is the best way in using regular expression to see if a certain string contains a value?

eg: if $string (".agae.geagr,AAA.BBB.CCC/aafg.afgadfeg3g") contains "AAA.BBB.CCC" etc ?

:)

Thanks!
Quote Reply
Re: [eric74] Reg Expression help In reply to
Hi,

This line should work

if ($string =~ /AAA\.BBB\.CCC/){

print "Match";
else{ print "Not match";}

Hope that helps

Cheers,

Dat

Scripts installation and plugin creation
Plugins
Quote Reply
Re: [tandat] Reg Expression help In reply to
index() would be quicker...it's not as flexible as regex though...

Code:
if (index($string, 'AAA.BBB.CCC') > -1) {
found
}
else {
not found
}
Quote Reply
Re: [Paul] Reg Expression help In reply to
Thanks guys!

Works brilliantly