![]() |
#1
|
|||
|
|||
![]()
I am formating a new Bible translation for a certain software.
The original document looks like this: Code:
[[@Bible:mat 1:1]][[1>>Bible:mat 1:1]] ईसा मसीह बिन दाऊद बिन इब्राहीम का नसबनामा : [[@Bible:mat 1:2]][[2>>Bible:mat 1:2]] इब्राहीम इस्हाक़ का बाप था, इस्हाक़ याक़ूब का बाप और याक़ूब यहूदा और उस के भाइयों का बाप। [[@Bible:mat 1:3]][[3>>Bible:mat 1:3]] यहूदा के दो बेटे फ़ारस और ज़ारह थे (उन की माँ तमर थी)। फ़ारस हस्रोन का बाप और हस्रोन राम का बाप था। [[@Bible:mat 1:4]][[4>>Bible:mat 1:4]] राम अम्मीनदाब का बाप, अम्मीनदाब नह्सोन का बाप और नह्सोन सल्मोन का बाप था। [[@Bible:mat 1:5]][[5>>Bible:mat 1:5]] सल्मोन बोअज़ का बाप था (बोअज़ की माँ राहब थी)। बोअज़ ओबेद का बाप था (ओबेद की माँ रूत थी)। ओबेद यस्सी का बाप और [[@Bible:mat 1:6]][[6>>Bible:mat 1:6]] यस्सी दाऊद बादशाह का बाप था। Code:
[[@Bible:Matt 1:1]][[1>>Bible:Matt 1:1]]{{field-on:Bible}} ईसा मसीह बिन दाऊद बिन इब्राहीम का नसबनामा :{{field-off:Bible}} [[@Bible:Matt 1:2]][[2>>Bible:Matt 1:2]]{{field-on:Bible}} इब्राहीम इस्हाक़ का बाप था, इस्हाक़ याक़ूब का बाप और याक़ूब यहूदा और उस के भाइयों का बाप।{{field-off:Bible}} [[@Bible:Matt 1:3]][[3>>Bible:Matt 1:3]]{{field-on:Bible}} यहूदा के दो बेटे फ़ारस और ज़ारह थे (उन की माँ तमर थी)। फ़ारस हस्रोन का बाप और हस्रोन राम का बाप था।{{field-off:Bible}} [[@Bible:Matt 1:4]][[4>>Bible:Matt 1:4]]{{field-on:Bible}} राम अम्मीनदाब का बाप, अम्मीनदाब नह्सोन का बाप और नह्सोन सल्मोन का बाप था।{{field-off:Bible}} [[@Bible:Matt 1:5]][[5>>Bible:Matt 1:5]]{{field-on:Bible}} सल्मोन बोअज़ का बाप था (बोअज़ की माँ राहब थी)। बोअज़ ओबेद का बाप था (ओबेद की माँ रूत थी)। ओबेद यस्सी का बाप और{{field-off:Bible}} [[@Bible:Matt 1:6]][[6>>Bible:Matt 1:6]]{{field-on:Bible}} यस्सी दाऊद बादशाह का बाप था। दाऊद सुलैमान का बाप था (सुलैमान की माँ पहले ऊरिय्याह की बीवी थी)।{{field-off:Bible}} Code:
Sub LogosField() ' ' LogosField Macro ' ' With ActiveDocument.Content.Find .ClearFormatting .Replacement.ClearFormatting .Text = "\[\[*\]\]\[\[*\]\]" .Replacement.Text = "{{field-off:Bible}}^&{{field-on:Bible}}" .Forward = True .Wrap = wdFindContinue .Format = False .MatchWildcards = True .Execute Replace:=wdReplaceAll End With End Sub Code:
{{field-off:Bible}}[[@Bible:mat 1:1]][[1>>Bible:mat 1:1]]{{field-on:Bible}} ईसा मसीह बिन दाऊद बिन इब्राहीम का नसबनामा : {{field-off:Bible}}[[@Bible:mat 1:2]][[2>>Bible:mat 1:2]]{{field-on:Bible}} इब्राहीम इस्हाक़ का बाप था, इस्हाक़ याक़ूब का बाप और याक़ूब यहूदा और उस के भाइयों का बाप। {{field-off:Bible}}[[@Bible:mat 1:3]][[3>>Bible:mat 1:3]]{{field-on:Bible}} यहूदा के दो बेटे फ़ारस और ज़ारह थे (उन की माँ तमर थी)। फ़ारस हस्रोन का बाप और हस्रोन राम का बाप था। {{field-off:Bible}}[[@Bible:mat 1:4]][[4>>Bible:mat 1:4]]{{field-on:Bible}} राम अम्मीनदाब का बाप, अम्मीनदाब नह्सोन का बाप और नह्सोन सल्मोन का बाप था। {{field-off:Bible}}[[@Bible:mat 1:5]][[5>>Bible:mat 1:5]]{{field-on:Bible}} सल्मोन बोअज़ का बाप था (बोअज़ की माँ राहब थी)। बोअज़ ओबेद का बाप था (ओबेद की माँ रूत थी)। ओबेद यस्सी का बाप और {{field-off:Bible}}[[@Bible:mat 1:6]][[6>>Bible:mat 1:6]]{{field-on:Bible}} यस्सी दाऊद बादशाह का बाप था। दाऊद सुलैमान का बाप था (सुलैमान की माँ पहले ऊरिय्याह की बीवी थी)। {{field-off:Bible}} Any suggestions? |
#2
|
||||
|
||||
![]()
You don't need a macro for this - it can be done with a wildcard Find/Replace, where:
Find = (\]\])([!^13\]]@)^13 Replace = \1{{field-on:Bible}}\2{{field-off:Bible}}^p That said, you could simply replace your existing Find/Replace parameters with the above: Code:
Sub LogosField() ' ' LogosField Macro ' Application.ScreenUpdating = False With ActiveDocument.Content.Find .ClearFormatting .Replacement.ClearFormatting .Forward = True .Format = False .Wrap = wdFindContinue .MatchWildcards = True .Text = "(\]\])([!^13\]]@)^13" .Replacement.Text = "\1{{field-on:Bible}}\2{{field-off:Bible}}^p" .Execute Replace:=wdReplaceAll End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
That seemed to work beautifully! Thanks! I'll have to analyze it a bit to learn exactly what you did.
|
![]() |
Tags |
macro, macro find and replace |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Need Short Macro-Find and Replace | rsrasc | Word VBA | 2 | 11-10-2014 05:03 PM |
![]() |
amparete13 | PowerPoint | 3 | 03-11-2014 05:29 AM |
![]() |
bertietheblue | Word VBA | 12 | 11-04-2013 05:35 PM |
macro or find/replace | JamesVenhaus | Word | 2 | 02-27-2012 03:34 PM |
Find and Replace Macro - A Better Way | Tribos | Word VBA | 0 | 10-08-2008 03:22 AM |