Hi--is anybody there give me little insight on how to solve rather a puzzle here;)--
Thanks in advance--Cheers--Simin
Case Expression:
-------------------------
We need to first find the string "***TOP",then in every 3rd line from that string for eg: in "[&Group Title]" we need to append an index so it will look like "[&Group Title_1]"--The indexing rule takes every 3rd line from the string "***TOP" as the main title indexing and in between we have the sub indexing--
Input Text:
--------------
***TOP1
**XXX
[&Group Title]
13_xxxxx [visual aid]_to
33_xxxxx [visual aid]_from
.01_xxxxx [visual usage]_tout
[--]
***TOP2
**YYY
21_yyyyyyy [&File]
22_yyyyyyy [visual impact]_to
1_yyyyyyy [visual impact]_from
Expected Result:
-------------------------
***TOP1
**XXX
[&Group Title_1]
13_xxxxx [visual aid_1]_to
33_xxxxx [visual aid_2]_from
.01_xxxxx [visual usage_3]_tout
[--]
***TOP2
**YYY
21_yyyyyyy [&File_2]
22_yyyyyyy [visual impact_1]_to
1_yyyyyyy [visual impact_2]_from
RE Search and replace
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
Re: RE Search and replace
FInd:
***TOP1\n\(.*\)\n\(.*\)\]
Replace by
***TOP1\n\1\n\2_\i]
RegEx must be activated
***TOP1\n\(.*\)\n\(.*\)\]
Replace by
***TOP1\n\1\n\2_\i]
RegEx must be activated
Re: RE Search and replace
I am afraid the above trick is not working--i am getting *Invalid regular expression* error message--
Re: RE Search and replace
You are right.
it should be replace
\*\*\*TOP1\n\(.*\)\n\[(.*\)\]
by
***TOP1\n\1\n[\2_\i]
it should be replace
\*\*\*TOP1\n\(.*\)\n\[(.*\)\]
by
***TOP1\n\1\n[\2_\i]
Re: RE Search and replace
thanks a mil--it is me again bugging u--this time it is giving me some *unmatched [ or (* error--is it that anything me doing is wrong????--also i just want to point you for setting the anchor we cannot use ***TOP1,because it is also changing instead we can use ***TOP as the anchor--also i think this RE doesnt take care of the second level indexing--can that be also handled in a single find replace or we have to go for a second level find replace--am i asking too much if i ask for giving little explanation of the above RE--thank in advance--Simin--
Re: RE Search and replace
\*\*\*TOP1\n\(.*\)\n\[\(.*\)\]
one backslash was missing.
\* finds literal *
TOP1 finds literal TOP1
\n finds linebreak
. finds any character
* finds any amount of what is to its left
.* therefore finds any amount of any characters
\(\) do not find anything, but whatever is found by the stuff within is remembered
\[ finds literal [
\] finds literal ]
Replace expression:
***TOP1\n\1\n[\2_\i]
***TOP1 puts exactly this into the text
\n puts a linebreak int the text
\1 puts whatever was found within the first \(\) into the text
[ puts a [ into the text
\2 puts whatever was found within the second \(\) into the text
] puts a ] into the text
"take care of the second level indexing": what are you talking about?
one backslash was missing.
\* finds literal *
TOP1 finds literal TOP1
\n finds linebreak
. finds any character
* finds any amount of what is to its left
.* therefore finds any amount of any characters
\(\) do not find anything, but whatever is found by the stuff within is remembered
\[ finds literal [
\] finds literal ]
Replace expression:
***TOP1\n\1\n[\2_\i]
***TOP1 puts exactly this into the text
\n puts a linebreak int the text
\1 puts whatever was found within the first \(\) into the text
[ puts a [ into the text
\2 puts whatever was found within the second \(\) into the text
] puts a ] into the text
"take care of the second level indexing": what are you talking about?