in reply to Re: Regex not working
in thread Regex not working
The output that I need for this is - The CORRECT OUTPUTuse strict; use warnings; FindInHorizontalRegion('SETTINGS:Flight','SETTINGS:Tick','1000',10); #FindInHorizontalRegion('Flight','SETTINGS:Tick','1000',10); sub FindInHorizontalRegion { print "Inside FindInHorizontalRegion \n" ; my ( $element1,$element2,$duration,$threshold) = @_; my $regex1 = '(.*?)\:(.*?)' ; print "The first element is $element1 \n....The second element is +$element2 \n... Entering if condition for the first time to check if +it is text or image \n"; if ( $element1 =~ m/$regex1/g ) { print "The regex is matched and the first element is an image\n"; } else { print "THe first element is text \n"; } if ( $element2 =~ m/$regex1/g ){ print "The second element is an image \n"; } else { print "THe second element is text \n"; } print "Horizontal coordinates obtained \n"; if ( $element1 =~ m/$regex1/g) { print "To check for Image \n"; } else { print "To check for Text \n"; } }
Inside FindInHorizontalRegion
The first element is SETTINGS:Flight
....The second element is SETTINGS:Tick
... Entering if condition for the first time to check if it is text or image
The regex is matched and the first element is an image
The second element is an image
Horizontal coordinates obtained
To check for Image
but the output that I am getting is different in the last line.. The output that I GET
Inside FindInHorizontalRegion
The first element is SETTINGS:Flight
....The second element is SETTINGS:Tick
... Entering if condition for the first time to check if it is text or image
The regex is matched and the first element is an image
The second element is an image
Horizontal coordinates obtained
To check for Text
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Regex not working
by graff (Chancellor) on Sep 13, 2011 at 08:35 UTC | |
by Perllace (Acolyte) on Sep 14, 2011 at 05:45 UTC |