The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
perl regexp mirusnet Shell Programming and Scripting 1 04-04-2008 05:15 PM
lazy capture don't work (regexp in perl) umen Shell Programming and Scripting 1 09-01-2006 01:02 PM
loop throw perl regexp selection umen Shell Programming and Scripting 6 08-28-2006 11:35 AM
change function structure with perl (regExp) umen Shell Programming and Scripting 1 08-19-2006 11:20 AM
Need Help with Perl REGEXP mh53j_fe Shell Programming and Scripting 1 01-17-2006 09:49 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 10-18-2006
umen umen is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 239
perl regexp error , I cant understand what is wrong

perl regexp error , I cant understand what is wrong
Hello all
I have simple perl regexp that is searching for pattern in string and replace it with the same string + addition string
here is what I have :

Code:
my $rec =  q| new Array("Attributes Management"  ,"/ResourceManagement/Attribute/attributeFrameset.jsp","/Images/icons/attributes.gif",null,"AttributesManagement"),|;


Code:
rec =~ s/[^+\s*](\"\/.*?[jsp|gif|css|bmp|js]\")/handle_path($1,1)/gse;

and the handle_path function lookes like this :


Code:
sub handle_path {

	my $s = $_[0];
	my $type = $_[1];
	 
	if($type == 0){
		return "Env.getPath()+".$s;
	}elsif($type == 1){
		my $tmpStr = "\<\%= Env.getPath() \%\>\+".$s;
		return $tmpStr;
		
	}

}

but the result im getting is almost fine .. there is missing comma in there , and i have no idea why
the comma is missing after the switching . for example between the "Attributes Management" and <%= Env.getPath() %>
Here is the result:
new Array("Attributes Management" <%= Env.getPath() %>+"/ResourceManagement/Attribute/attributeFrameset.jsp"<%= Env.getPath() %>+"/Images/icons/attributes.gif",null,"AttributesManagement"),
can someone please tell me what im doing wrong here?
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:33 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0