# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"(?:.*\n){1} End Object"
test_str = ("class a_u000_a extends Emitter; // 이상상태 (독)\n\n"
"defaultproperties\n"
"{\n"
" Begin Object Class=SpriteEmitter Name=SpriteEmitter1\n"
" Acceleration=(Z=-100.000000)\n"
" UseColorScale=True\n"
" ColorScale(0)=(Color=(B=140,G=64,R=135,A=255))\n"
" ColorScale(1)=(RelativeTime=1.000000,Color=(B=120,G=63,R=106,A=255))\n"
" ColorMultiplierRange=(X=(Min=0.800000),Y=(Min=0.800000),Z=(Min=0.800000))\n"
" FadeOutStartTime=1.080000\n"
" FadeOut=True\n"
" FadeInEndTime=0.120000\n"
" FadeIn=True\n"
" MaxParticles=20\n"
" RespawnDeadParticles=False\n"
" Name=\"Poison\"\n"
" StartLocationOffset=(Z=-3.000000)\n"
" StartLocationRange=(X=(Min=-8.000000,Max=8.000000),Y=(Min=-8.000000,Max=8.000000))\n"
" SpinParticles=True\n"
" SpinsPerSecondRange=(X=(Min=0.050000,Max=0.200000))\n"
" StartSpinRange=(X=(Max=1.000000))\n"
" UseSizeScale=True\n"
" UseRegularSizeScale=False\n"
" UniformSize=True\n"
" SizeScale(0)=(RelativeTime=0.100000,RelativeSize=3.000000)\n"
" SizeScale(1)=(RelativeTime=0.360000,RelativeSize=4.600000)\n"
" SizeScale(2)=(RelativeTime=1.000000,RelativeSize=6.000000)\n"
" StartSizeRange=(X=(Min=2.000000,Max=4.500000),Y=(Min=2.000000,Max=4.500000),Z=(Min=2.000000,Max=4.500000))\n"
" InitialParticlesPerSecond=30.000000\n"
" AutomaticInitialSpawning=False\n"
" DrawStyle=PTDS_AlphaBlend\n"
" Texture=Texture'LineageEffectsTextures.Particles.fx_m_t0089'\n"
" TextureUSubdivisions=2\n"
" TextureVSubdivisions=2\n"
" BlendBetweenSubdivisions=True\n"
" SubdivisionEnd=4\n"
" LifetimeRange=(Min=1.000000,Max=2.000000)\n"
" StartVelocityRange=(X=(Min=-80.000000,Max=80.000000),Y=(Min=-80.000000,Max=80.000000),Z=(Min=30.000000,Max=30.000000))\n"
" VelocityLossRange=(X=(Min=4.000000,Max=4.000000),Y=(Min=4.000000,Max=4.000000),Z=(Min=4.000000,Max=4.000000))\n"
" Name=\"SpriteEmitter1\"\n"
" End Object\n"
" Emitters(0)=SpriteEmitter'LineageEffect.a_u000_a.SpriteEmitter1'\n"
" bNoDelete=False\n"
" DrawScale=0.200000\n"
"}")
subst = " End Object"
# You can manually specify the number of replacements by changing the 4th argument
result = re.sub(regex, subst, test_str, 0, re.MULTILINE)
if result:
print (result)
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html