Jump to content


Photo

Removing a code block with regular expressions


2 replies to this topic

#1 argent77

argent77
  • Members
  • 267 posts
  • Gender:Male

Posted 27 February 2012 - 01:22 PM

Hello,

I'm stuck for a while now at a regular expression to remove a certain code block from a BCS file. Whatever I try, it either does nothing or swallows everything in the file.

This is my TP2 code (the one which swallows all):
COPY_EXISTING ~ar5504.bcs~ ~override~
  DECOMPILE_BCS_TO_BAF
	REPLACE_TEXTUALLY CASE_SENSITIVE EVALUATE_REGEXP
	  ~^IF[%LNL%].*OnCreation()\([%LNL%].*\)+END$~ ~~
  COMPILE_BAF_TO_BCS
  BUT_ONLY_IF_IT_CHANGES

And this is the script block I want to remove:
IF
  OnCreation()
  Global("MONKSPAWNEDSMUGGLERPLOT","GLOBAL",2)
  Global("FADEDIN","MYAREA",0)
  !Global("Enclave","GLOBAL",2)
THEN
  RESPONSE #100
	FadeToColor([1.0],0)
	Wait(2)
	FadeFromColor([30.0],0)
	SetGlobal("FADEDIN","MYAREA",1)
END

// more code blocks...

Maybe I'm missing something obvious, but I'm at my wits end for now. Any help is appreciated.

Edited by argent77, 27 February 2012 - 01:24 PM.

Imagination is more important than knowledge. Knowledge is limited; imagination encircles the world. - Albert Einstein

 

My contributions:


#2 lynx

lynx
  • Modders
  • 1870 posts
  • Gender:Male
  • Location:Ljubljana, Slovenija

Posted 27 February 2012 - 01:55 PM

if . doesn't match the newline, one is missing before END.

GemRB - IE anywhere.
Mages needed! Python tamers needed for iwd2!

Market android version IS NOT SUPPORTED ANYMORE: reported bugs will be ignored!


#3 argent77

argent77
  • Members
  • 267 posts
  • Gender:Male

Posted 27 February 2012 - 02:24 PM

Thank you. Adding a newline match before END alone didn't do the trick, however. I also had to change the ".*" into a ".+"

Imagination is more important than knowledge. Knowledge is limited; imagination encircles the world. - Albert Einstein

 

My contributions:




Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users