Thread regex escape (11 answers)
Opened by jmb at 2006-02-21 17:01

root
 2006-02-24 01:11
#63131 #63131
User since
2003-08-15
120 Artikel
BenutzerIn
[default_avatar]
Ich kapiers nicht! Ist ja auch schon bissi spät...

Ich habe diesen Text
Quote
...
<!-- start oe2edit fileinfo -->
<!--
This is a oe2edit contentfile
It should have no <html> <head> <body> tag, because it will be placed in another html file

The following variables discribe how long this content will be active
start_date=23.02.2006 23:30
end_date=01.01.1970 01:00
start_timestamp=1140733800
end_timestamp=0

The following variables show the status of authentification from oe2edit autherware
auth_query are all users for authentification, auth_permit permission allredy arrived from these users
auth_query=
auth_permit=

Last modification by oe2edit of this contentfile
last_update_date=23.02.2006 23:31
last_update_username=admin
-->
<!-- end oe2edit fileinfo -->
...


und den möchte ich gerne einfach nur weg haben, in meinem Bsp jetzt soll er durch "PASST" ersetzt weder, dann sehe ich schneller dass es nicht klappt...

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
    # oe file info aus code löschen
my $start_regex = "\Q<!-- start oe2edit fileinfo -->\E";
my $end_regex = "\Q<!-- end oe2edit fileinfo -->\E";

###### LÖSCHEN #####
open( FILE, ">test.txt" );
print FILE 's/'.$start_regex.'.+'.$end_regex.'/PASST/i';
close (FILE);
##### NUR TEST #####


$htmlcode =~ s/$start_regex.+$end_regex/PASST/i;# if($$USER_ref{'type'} ne "admin");


Dateiinhalt von test.txt:
Quote
s/\<\!\-\-\ start\ oe2edit\ fileinfo\ \-\-\>.+\<\!\-\-\ end\ oe2edit\ fileinfo\ \-\-\>/PASST/i


Er findets nicht! Warum??? Hilfe!
Er tut einfach gar nichts!

View full thread regex escape