-
1. Re: XML tag markers moved: Find and Replace causing problem in xml elements
P Spier Apr 11, 2011 5:55 AM (in response to Green4ever)You should probably tell us the grep strings used int he find/change...
-
2. Re: XML tag markers moved: Find and Replace causing problem in xml elements
Green4ever Apr 11, 2011 6:05 AM (in response to P Spier)For example like this,
Find What--------> (;)<space>(\w{2})
Change To--------> $1~m$2
This is just for example....
-
3. Re: XML tag markers moved: Find and Replace causing problem in xml elements
P Spier Apr 11, 2011 6:23 AM (in response to Green4ever)I'm far from being a GREP expert, but it seems to me that the example is looking for any space that follows a semi-colon and has two word characters following it, and repalce that with an em space. I think you could do the same using look behind and look ahead and not need to replace the found text.
But I'm not really sure why you want to be sure that there are two word characters following the space. Are there occasions when there are some spaces you want to replace and some you want to preserve?
For example, in the text in yor screen captures, you've replaced the semi-colon space combo with an em space. Why not simply look for ;\s and replace with ~m ?
-
4. Re: XML tag markers moved: Find and Replace causing problem in xml elements
John Hawkinson Apr 11, 2011 9:00 AM (in response to Green4ever)I think this is a natural consequence of InDesign trying to guess what to do, because there is no way to express the positioning of XML tag markers in the replace expression. This is just like how if you have "longword1 longword2" and you replace "word1 long" with "an even longer word that you hope works right," InDesign has to guess and figure out what you want to do for boldface. In my case it gives "longan even longer..." which is probably not what you want.
The best solution is to never cross a boundary (boldface/not-boldface; or an XML tag marker) with a replacement string. That's not always easy...
-
5. Re: XML tag markers moved: Find and Replace causing problem in xml elements
Green4ever Apr 11, 2011 9:58 PM (in response to P Spier)Hi Peter and John,
but it seems to me that the example is looking for any space that follows a semi-colon and has two word characters following it, and repalce that with an em space. I think you could do the same using look behind and look ahead and not need to replace the found text.
Yes you are right about the look behind and look ahead. I'd like to show some more examples to show what the actual problem is,
Original/Before Replacing,
(Consider there is another case here, instead of em-space some times normal word space will also be there)
Using the Grep:
Find What---------> ^(\d+\.(?:\d+)?)~m
Change To------------->$1\t
After Replace:
Did I make any sense? Eventhough this will not make any changes in the layout, my requirement is to insert the tab out-side the tag marker not indise.
----------
Green4ever
-
6. Re: XML tag markers moved: Find and Replace causing problem in xml elements
P Spier Apr 12, 2011 5:03 AM (in response to Green4ever)I don't work with XML, so I can't really test this, but again, I think you should be using a look-behind for this, NOT replacing text with itself. The look-behind wouldn not, I think, disturb the markers.
-
7. Re: XML tag markers moved: Find and Replace causing problem in xml elements
Green4ever Apr 12, 2011 6:27 AM (in response to P Spier)Yes, look behind will not touch the marker of-course. But then in a single expression you can't do the all the replacements.
For example: (Assume that all are xml tagged as shown in the previous screen shot)
1st case:
4.1<emspace>Agent or experiencer expressed as possessor
2nd case:
4.11<emspace>Agent or experiencer expressed as possessor
3rd case:
4.112<emspace>Agent or experiencer expressed as possessor
For replacing the emspace with tab I have to use three different Grep expressions. Because inside the look-behind or look-ahead expressions "+" (one or more) is not allowed.
for 1st:----------> (?<=\d\.\d)~m
for 2nd:----------> (?<=\d\.\d\d)~m
for 3rd:----------> (?<=\d\.\d\d\d)~m
Is there any way to do this in a single find and replace.
-
8. Re: XML tag markers moved: Find and Replace causing problem in xml elements
P Spier Apr 12, 2011 6:59 AM (in response to Green4ever)You only need to look for the last digit. It doesn't matter how many there are.
-
9. Re: XML tag markers moved: Find and Replace causing problem in xml elements
Jeremy bowmangraphics Apr 12, 2011 8:31 AM (in response to Green4ever)Would it be possible to make up a few character styles for the tags in question, map tags to styles, make the changes, then map styles back to tags? It least you have more control over styles than tags when replacing.
EDIT: Untagging after mapping tags to styles, I meant to say as well.




