Find/Replace - ignoring tabs, spaces & everything inbetw

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
cwigley
Posts: 14
Joined: Fri Apr 21, 2006 2:48 pm
Location: New York, NY

Find/Replace - ignoring tabs, spaces & everything inbetw

Post by cwigley »

Hello,
I'm trying to streamline a series of commands that searches for a specific string that has been indented ("Image Area=Image Area") & changes some text that appears a few lines after("Y2=479" becomes "Y2=576"):

Code: Select all

							Image Area=Image Area
							{
								X1=0
								Y1=0
								X2=719
								Y2=479
							}
The reason I have to search for "Image Area..." is because the "Y2=479" appears as a parameter in other areas of my script that I don't want to change. I only want to change the "Y2=479" parameter under "Image Area".

The other tricky part is that "Image Area" settings are indented various amounts throughout the script.

So what I need to figure out, is how to select:
"Image Area=Image Area(include everything between)Y2=479"
Replace with
"Image Area=Image Area(dont touch anything between)Y2=576"

Any help on how I can accomplish this would be much appreciated.

- Collin
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

Despite the varying indentation, will it always look like this (4 params always)
Image Area=Image Area
{
param1
param2
param3
param4
}

479 always going to become 576?
I choose to fight with a sack of angry cats.
cwigley
Posts: 14
Joined: Fri Apr 21, 2006 2:48 pm
Location: New York, NY

Post by cwigley »

Yes. For this part, it will always look like that (4 parameters), and I will always need to change it "576"


Thank you!
cwigley
Posts: 14
Joined: Fri Apr 21, 2006 2:48 pm
Location: New York, NY

Post by cwigley »

Here is a perfect example to test with:

Code: Select all

									Data Stream=DCS Stream
									{
										Item=Display Start
										{
											Data=
											Start Time To Video=00:00:00;00
											Resolution=NTSC
											Drop Type=Non-drop frame
											Start Time=00:00:00;00
											Duration=00:00:00;01
											Forced Start=No
											Image Area=Image Area
											{
												X1=0
												Y1=0
												X2=719
												Y2=479
											}
											Display Area=Display Area
											{
												X1=0
												Y1=2
												X2=719
												Y2=479
											}
											Pixel Area=Pixel Area
											{
												Top=2
												Bottom=479
											}
											Color=Color
											{
												Color 1(E2)=13
												Color 2(E1)=14
												Color 3(P)=15
												Color 4(Bg)=16
											}
											Contrast=Contrast
											{
												Color 1(E2)=0 %
												Color 2(E1)=0 %
												Color 3(P)=0 %
												Color 4(Bg)=0 %
											}
										}
										Item=Display Stop
										{
											Data=
											Start Time To Video=00:00:00;01
											Resolution=NTSC
											Drop Type=Non-drop frame
											Start Time=00:00:00;00
											Duration=00:00:01;00
										}
									}
									Size Type=720 x 480
									Type=menu
									Image Type=Image
								}



							Data Stream=DCS Stream
							{
								Item=Display Start
								{
									Data=
									Start Time To Video=00:00:00;00
									Resolution=NTSC
									Drop Type=Non-drop frame
									Start Time=00:00:00;00
									Duration=00:00:00;01
									Forced Start=Yes
									Image Area=Image Area
									{
										X1=0
										Y1=0
										X2=719
										Y2=479
									}
									Display Area=Display Area
									{
										X1=0
										Y1=2
										X2=719
										Y2=479
									}
									Pixel Area=Pixel Area
									{
										Top=2
										Bottom=574
									}
									Color=Color
									{
										Color 1(E2)=16
										Color 2(E1)=15
										Color 3(P)=14
										Color 4(Bg)=13
									}
									Contrast=Contrast
									{
										Color 1(E2)=0 %
										Color 2(E1)=0 %
										Color 3(P)=0 %
										Color 4(Bg)=0 %
									}
								}
								Item=Display Stop
								{
									Data=
									Start Time To Video=00:00:38;23
									Resolution=NTSC
									Drop Type=Non-drop frame
									Start Time=00:00:00;00
									Duration=00:00:01;00
								}
							}
							Size Type=720 x 480
							Type=menu
							Image Type=Image
						}
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

If the text Y2=479 is always on the fifth line following the text Image Area=Image Area, then something like this should do it:
Find what: (Image Area=Image Area)\n(.*)\n(.*)\n(.*)\n(.*)\n( *)Y2=479
Replace with: \1\n\2\n\3\n\4\n\5\n\6Y2=576

[X] Regular expression

Replace All
This assumes you are using Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
It also assumes that Maintain indentaion is not set for the document. Deselect
Configure | Preferences | Document Classes | <Class> | Maintain indentaion
or
View | Document Properties | Preferences | Maintain indentaion.
cwigley
Posts: 14
Joined: Fri Apr 21, 2006 2:48 pm
Location: New York, NY

Post by cwigley »

Thank you - That worked! I did make one lil adjustment. There seems to be a missing "." at the end of the search string, right before the last "*" - as soon as I added that, it worked like a charm.

- Collin
Post Reply