XML tag markers moved: Find and Replace causing problem in xml elements

Hi All,
I am doing find and replace using GREP. While using the expression like $1, $2 (Found Items) in the change to field it changes the placement of tag marker. If the found item is a part of two of more xml elements, I am getting a serious problem while replacing it. (ie. The xml tag markers are moved.)
See the screen shot below, then you may get better idea. And help me to overcome this issue.
This is just an example to show you what i'm trying to say, there are so many cases like this.
Original text/ Before doing find replace
After replacing
Green4ever

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

Similar Messages

  • Find and Replace for XML

    I have requirements for searching through XML files and performing a number of different Find and Replace functions. They include Find and Replace:
    - on content in any element
    - on content within a specified element
    - on attribute values within a specified element
    - on attribute names within a specified element
    - on element type names themselves
    The last 2 Find and Replace types could invalidate the document. I'm thinking DOM would be most appropriate for this. Which java packages/classes/technologies are the best to use? BTW, I've got some experience with java and a little less with XML.
    Thanks....

    Hi, here is what I suggest: You can use DOM or JDOM as your tecnology. I prefer to use DOM because is the one I'm familiar with.
    For the first three assignments, you can use DOM methods to get node text, data, etc.(look for the API/examples in the web). For the 2 last assignments, you may need to use XSLT to produce the OUT put XML and in some cases use filtering and concatenation. See http://java.sun.com/webservices/docs/1.0/tutorial/index.html.
    Good luck!

  • How can i find and replace xml tags?

    Hi, i am using xml in my workflow and want to be able to remove certain tags if they contain particular text.
    here is an example of my xml structure…
    <entry>
        <name>DEFAULT</name>
        <tel>DEFAULT</tel>
        <address>DEFAULT</address>
    </entry>
    I am using this initial structure to set the paragraph styles to be followed when the xml data is imported.
    This leaves DEFAULT in place wherever an entry doesn't have any content for that field.
    I want to be able to import my XML then run a script that removes any tags that include DEFAULT, - I need the entire xml tag to be removed not just the text, if i do a normal find and replace it will only remove the text not the tags which is causing problems with styling. I also want to remove the end of para/return (^p) that i've placed at the end of the line. So it would be the same as opening up story editor and removing the content + tags + hard return in there, but i want to automate the process…
    So i think this is what i need to search for in each case
    "<name>DEFAULT</name>^p"
    and i want to replace it with nothing ""
    Can this be done through scripting (ideally javascript)?
    I have a little knowledge of javascript but am not sure how to search and target that kind of string in indesign...
    using indesign cs5
    many thanks

    Hi,
    Script should do it in two steps:
    1. find all occurences of i.e. ">DEFAULT<"
    2. remove whole paragraph which is a found_text's container.
    For example this way -JS - (a textFrame filled with your text should be selected) :
    var mStory = app.selection[0].parentStory;
    app.findTextPreferences =  null;
    app.findTextPreferences.findWhat = ">DEFAULT<";
    var myF = mStory.findText();
    var count = myF.length;
    while (count--)
         myF[count].paragraphs[0].remove();
    rgds

  • How to use Microsoft Word's Find and Replace with HTML tags?

    Hello to all!
    I'm trying to figure out how to use the find and replace function in Word to replace html tags. I'd like to be able to change something like this:
    <span class="B01-K-ITAL">random text</span>
    To something like this:
    <em>random text</em>
    I want to replace the open and close tags without changing or interfering with the text between the tags. I'm pretty sure I should use wildcards, but I can't figure out how to use them properly.
    Anyone able to lend a hand?

    Here is my latest regular expression with Perl.   I think it matches the spirit of the request in the original post.
    Note, this isn't as easy as you think.  You need to code up the complete set of html rules in you implementation. You need to allow for a certain amount of mal-formed html.
    perl -0660pe 's^<[sS][pP][aA][nN]\s+class="B01-K-ITAL"\s*>(.*?)</[sS][pP][aA][nN]>^<em>$1</em>^gs' i.html >|o.html
    input text
     <html> <head>...</head> <body>I'd like to be able to change something like this: <span class="B01-K-ITAL">#1 one line</span> I want to replace the open and close tags without changing or interfering with the text between the tags. I'm pretty sure I should use wildcards, but I can't figure out how to use them properly. <p>note, this isn't as easy as you think.  You need to code up the complete set of html rules in you implementation. You need to allow for a certain amount of mal-formed html.</p> <span class="B01-K-ITAL">#2 don't be greedy</span> <span class="B01-K-ITAL">$3 multiline text</span> <span class="B01-K-ITAL">#4 multiline tag. I believe html allow a carriage return in white space of tags</span> <span class="B01-K-ITAL">#5 split after the class tag. optional white space</span> <sPan class="B01-K-ITAL">#6 mixed case tag</Span> <p>no text #7</p><span class="B01-K-ITAL"></span> <!-- Apparently, this is valid     http://www.positioniseverything.net/articles/cc-plus.html --> <!--[if IE]> <div id="IEroot"> <![endif]--> <p id="IE">This browser is IE.</p> <p id="notIE">This browser is not IE.</p><!--[if IE]> </div> <![endif]--></body> </html>
    output text
     <html> <head>...</head> <body>I'd like to be able to change something like this: <em>#1 one line</em> I want to replace the open and close tags without changing or interfering with the text between the tags. I'm pretty sure I should use wildcards, but I can't figure out how to use them properly. <p>note, this isn't as easy as you think.  You need to code up the complete set of html rules in you implementation. You need to allow for a certain amount of mal-formed html.</p> <em>#2 don't be greedy</em> <em>$3 multiline text</em> <em>#4 multiline tag. I believe html allow a carriage return in white space of tags</em> <em>#5 split after the class tag. optional white space</em> <em>#6 mixed case tag</em> <p>no text #7</p><em></em> <!-- Apparently, this is valid     http://www.positioniseverything.net/articles/cc-plus.html --> <!--[if IE]> <div id="IEroot"> <![endif]--> <p id="IE">This browser is IE.</p> <p id="notIE">This browser is not IE.</p><!--[if IE]> </div> <![endif]--></body> </html>

  • Find and Replace using specific tags

    is there a way to find-and-replace my <a href= ""> to
    equal whatever is in their nested <img src> tag?
    for example, if i have a photo gallery with:
    <a href="url1.htm"><img src="imagea.jpg"
    /></a>
    <a href="url2.htm"><img src="imageb.jpg"
    /></a>
    <a href="url3.htm"><img src="imagec.jpg"
    /></a>
    is there a way to make it turn into:
    <a href="imagea.jpg"><img src="imagea.jpg"
    /></a>
    <a href="imageb.jpg"><img src="imageb.jpg"
    /></a>
    <a href="imagec.jpg"><img src="imagec.jpg"
    /></a>

    Short answer is no. There is no wildcard type functions in
    the replace
    command.
    Paul Whitham
    Certified Dreamweaver MX2004 Professional
    Adobe Community Expert - Dreamweaver
    Valleybiz Internet Design
    www.valleybiz.net
    "bwcb" <[email protected]> wrote in message
    news:eduj5o$lro$[email protected]..
    > is there a way to find-and-replace my <a href= "">
    to equal whatever is in
    > their nested <img src> tag?
    >
    > for example, if i have a photo gallery with:
    > <a href="url1.htm"><img src="imagea.jpg"
    /></a>
    > <a href="url2.htm"><img src="imageb.jpg"
    /></a>
    > <a href="url3.htm"><img src="imagec.jpg"
    /></a>
    >
    > is there a way to make it turn into:
    > <a href="imagea.jpg"><img src="imagea.jpg"
    /></a>
    > <a href="imageb.jpg"><img src="imageb.jpg"
    /></a>
    > <a href="imagec.jpg"><img src="imagec.jpg"
    /></a>
    >
    >

  • Bsp find and replace tag

    Hi,
    I want to know how to use find and replace tag of BSP.Actually my requirement is onchange of value in Input field i want to calculate somthing.Can any body help me.

    This looks pretty weird in coding ^^
    I would solve this issue with javascript only:
    function onLoad(){
         document.getElementById('myInputField').on'keyup = function(){startTimer();};
    var timer = null;
    function startT imer(){
       if(timer != null){
          window. clear'Timeout(timer);     
       timer = window. set'Timeout("timerTick()", 3000);
    function timerTick(){
       // calculate whatever you want
    When the user enters something in the myInputField a timer is startet. As soon as no key is hit for a minimum of 3 seconds, the calculation is done.
    I had to add the ' to the javascript functions because I get an error from the forum without...

  • Find and Replace Issue Help Requested.

    Hi all. I've been digging around for a couple of days and
    can't seem to figure this one out. For starters, I have already
    looked at the Regular Expression syntax and tried the MS word
    clean-up option, but no luck. We have about 1,500 pages of content.
    They are in DNN, so the pages are created dynamically.
    Unfortunately, the page content was written in Word and then dumped
    in DNN. We are trying to clean up the pages. We are grabbing the
    content from Dot Net Nuke and putting it into Dreamweaver 8.0.2.
    Then we are manually cleaning out things like:
    <?xml:namespace prefix = o ns =
    "urn:schemas-microsoft-com:office:office" />
    and
    <P class=MsoNormal style="MARGIN: 0in 0in 0pt"
    align=left>
    We are using the Find and Replace funtion in Dreamweaver to
    clean out these commands, but I know from the documentation, there
    is an easier way to clean these pages.
    Bottom Line: Since the pages are dynamically built, I know I
    have to grab the page content and put it in Dreamweaver manually
    and then put it back in DNN, but I am trying to find a way (using
    Regular Expressions or something) to look for all the little
    variances of MSO, <?XML, etc. in a straight shot. I would like
    to find a way to use a wild card to look for all tags that have MSO
    or Microsoft or ?XML in them and then replace them with a null
    value. From what I can tell, the Find would have to use a wildcard
    because the advanced find features don't carry what I am looking
    for. Something like Find \<?xml * [<-wildcard] to \> to
    grab the entire tag. The Find tag command doesn't work because the
    tags I need aren't listed. Also, because the content is dynamic, I
    can't do a Fins and Replace against the entire site for these
    commands, but it would be nice to "Find" all of these items with a
    single pass since the "Replace" value is always null.
    The wildcard syntax and multiple Find instances are the main
    questions. The wildcards seem to be character or space specific.
    Sorry for the long explanation - I just don't want to waste
    anyone's time typing responses to things I've already tried to do.
    Thanks in advance for any help. This is my first time back in
    the forums in about 4 years.

    sadamec1 wrote:
    > Well David, you Findmaster - it worked! (At least it
    found and highlighted the
    > code). Now, I need to dig through what you sent me and
    compare it against my
    > regular expression definitions to find out how to grab
    the rest of these
    > phrases. You're the best. Thank you!
    Glad that it did the trick. Just to help you understand what
    I did,
    there are two main sections, as follows:
    <\?xml[^>]+>
    and
    <[^>]+(?=class=Mso)[^>]+>
    They are separated by a vertical pipe (|), so they simply act
    as
    alternatives.
    The first one searches for <?xml followed by anything
    except a closing
    bracket until it reaches the first closing bracket.
    The second one is more complex. It begins with this:
    <[^>]+
    This simply looks for an opening bracket followed by anything
    other than
    a closing bracket. What makes it more intelligent is the next
    bit:
    (?=class=Mso)
    This does a forward search for "class=Mso". It's then
    followed by this
    again:
    [^>]+>
    That finds anything except a closing bracket followed by a
    closing bracket.
    The bit that you need to experiment with is (?=...). It's
    technically
    called a "forward lookaround". The effect is that the second
    half of the
    regex finds <....class=Mso....>.
    David Powers
    Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    http://foundationphp.com/

  • Find and replace

    I have decided to do color correction and other retouching after I edit a multicam shoot. Is there a way to copy and paste the attributes of a clip to only certain clips in a sequence like a find and replace. I know how to copy and paste attributes, now I just need to copy the attributes of cam 1 to all the cam 1 clips, cam 2 to cam 2, and so on.

    It can save a lot of time. I find that even for simple close-up interviews, small movements can cause shifts in the lighting and exposure such that I often wind up customizing the color on many of clips after pasting on the filters.
    Be sure to use the scopes and range check when you are doing CC. I often use markers in my sequence for clips I want to use as a reference for color. The 3-way color corrector works well to balance out the different color and luma ranges of the image.
    Another fast way to get the filter on lots of clips at once is to drag one from the filters tab to make a favorite you can rename, then drag it from there onto a selected batch of clips in the timeline. Sometimes it's easier to apply filters this way to smaller batches of clips, rather than try to manage automatically selecting all the clips from that angle or camera all at once.

  • Regular Expression + Find and Replace

    Hey there-  I have a question about regExp and the Find and Replace.  Basically I want to search a wildcard between a href tag, how would that look, because the code below does not work.
    countryLink = "<a href=\"http://www.whateve.com\" target=\"_parent\">";
    [code]
    countryLink = "([^"]*)";
    [code]
    Thanks! Any help is appreciated!
    Also, how do i add code blocks to this forum?

    Yes, I meant the <a> tag, but thank you for displaying the href attribute solution as well.  This solved my issue.  Thanks!  Thought I would display what I did with your code incase someone was interested in using this code to convert a javascript string to XML.
    query this:
    countryLink = "<a href=\"http://www.whateve.com\" target=\"_blank\">";
    add this to the Find box:
    countryLink = "<a href=\\"([-\w:/.?=&;]+)\\" target=\\"_parent\\">";
    add this to the Replace box:
    <countryLink>$1</countryLink>
    creates an output of this:
    <countryLink>http://www.whateve.com</countryLink>

  • How do I find and replace text in PHP files?

    How can I in CS3 make sitewide changes to the text in PHP pages without changing variable names etc that have the same name?
    For example if I have an installation of a PHP forum and I want to change every instance of the word 'forum' to 'message board'...
    If I used the 'inside tag' search with " as the tag, then if "" contained a variable called 'forum' it would also be changed and therefore corrupt the code....
    Is there a simple way around this?
    Thanks!
    I'm using CS3 on Windows Vista.

    It looks like you're trying to find and replace source code, so you may be able to look at the various places that are looked at when finding and uncheck the ones that don't apply.
    But, if it's all source code then that won't help.  One thing that may work is to expand the search option - for example if the work "forum" that you're wanting to change it preceded by another word, or character or something that sets it apart, then do you find on that. You can expand that search phrase as far out in either direction that you need to to make it different, if of course that is practical in your situation.
    The only other way I can think of is to somehow create an exception rule, but I'm not sure if that's possible or how to do it.

  • Find and replace by text and style

    We have a fairly large RH HTML project (300+ topics so far)
    most of which have a specific heading in Heading2 style. We want to
    change all of these to a style based on Heading2, but not use the
    Heading2 style b/c we don't want them to show up in the TOC. I have
    created a new style and can obviously open every topic and manually
    select and change each one - but I'm hoping that one of your RH
    gurus will tell me an easier way. Is there anything comparable to
    MS Words Find/Replace that will search the whole project for a
    specific word in a specific style?

    RoboHelp's Multi-File Find and Replace (in the Tools tab)
    should be suitable for this job, and you can control each
    occurrence as you choose. (Where this RH utility fails is when your
    search string might sit on more than one line, which won't be the
    case here.)
    You'll run two replacement passes (spaces added to < &
    > tags for proper viewing in this forum):
    Replace < h2 > with < p class=YourNewStyle >
    Replace < /h2 > with < /p >
    The < h2 > and < /h2 > strings will never be
    split between lines, so RH will catch every one.
    BTW, Add me to the list of FAR boosters; it'll let you change
    case, change file names, etc., etc., etc. Great tool!
    Good luck,
    Leon

  • Find and Replace using Behaviors

    I used Find and Replace in CS3 to add HTML code that includes
    a DW Behavior. The behavior opens a message popup when clicked.
    The Find and Replace works and by adding the Behavior code
    correctly. However, when I save the page and then click the link to
    test the behavior, the popup does not appear.
    The only way I can get the Behavior to work correctly is to
    complete the Find and Replace, double-click to open the Behavior
    from the Tag group, close the behavior and then resave the page.
    Is this a DW problem or am I doing something wrong?

    You are probably not adding all the necessary code during the
    search and
    replace. What exactly are you pasting in?
    Alec
    Adobe Community Expert

  • How to find and replace text in Excel with Automator

    I am new to Automator. And I would like some help how I can create a service that will allow me to find and replace certain text in Excel. I noticed that there is an action to do this for Word documents, but not for Excel document.
    Any suggestions how I can do this?
    Thanks so much for your help.

    Easiest way to do it is the following:
    - Open the PDF file in Acrobat.
    - Go to Tools - Forms - More Form Options - Export Data.
    - Save the form data as an XML file somewhere on your system.
    - Open XML the file in a plain-text editor (I recommend Notepad++).
    - Let's say you want to replace all the years in the dates from "2013" to "2014". Do a global Search&Replace of "2013-" to "2014-" (I added the dash just to make sure that only date fields are edited).
    - Save the XML file (maybe under a new name).
    - Go back to the PDF file, and now go to Tools - Forms - More Form Options - Import Data.
    - Select the edited XML file and import it.
    - Done!

  • How do you find and replace "within selected text" in a textedit document (version 1.8, mountain lion)

    In the textedit version on Snow leopard it was possible to search and replace within a peice of selected text only i.e. not the entire file. This was a very useful feature because you could select a paragraph and replace all occurences of word1 with word2 within that paragraph only! This feature appears to be missing from the mountain lion version of textedit (version 1.8). Or can anyone tell me how to do it ... ?

    Having 46 people view a post without replying is not unusual. Some people look at a question to see if it's something they'd like to know the answer to, and then come back  when it has eventually been answered.
    I'm not sure if you need to escape forward slashes in Dreamweaver's Find and Replace dialog box, but I normally do because both JavaScript and PHP normally use forward slashes as delimiters to mark the beginning and end of the regex like this:
    var pattern = /[A-Z]{4}/; // JavaScript
    $pattern = '/[A-Z]{4}/';   // PHP
    When a forward slash appears inside the regex, you need to escape it with a backslash to avoid confusion with the closing delimiter.
    As you have worked out, a capturing group is created by wrapping part of the regex in parentheses.
    If you want to match exactly 38 characters, you can use [\S\s]{38}. That includes spaces, newline characters, symbols, everything.
    If you're trying to find everything between two tags, you can do this:
    (<\/tag_name>)([^<]+)
    The closing tag is captured as $1 and everything up to the next opening tag is captured as $2.
    Learning regular expressions is not easy. I don't claim to be an expert, but I enjoy the challenge of trying to solve them. If you're interested in regular expressions, there are several books published by O'Reilly. "Mastering Regular Expressions" is the ultimate authority, but it's a difficult read (not because it's badly written, but because of the complexity of the subject). "Regular Expressions Cookbook" is very good. There's also a new "Introducing Regular Expressions", but I haven't read it.

  • How to find and replace data in form fields in acrobat xi, its not allowing to do so while trying, a

    how to find and replace data in form fields in acrobat xi, its not allowing to do so while trying, asking for adobe livecycle to get installed. please help.

    Easiest way to do it is the following:
    - Open the PDF file in Acrobat.
    - Go to Tools - Forms - More Form Options - Export Data.
    - Save the form data as an XML file somewhere on your system.
    - Open XML the file in a plain-text editor (I recommend Notepad++).
    - Let's say you want to replace all the years in the dates from "2013" to "2014". Do a global Search&Replace of "2013-" to "2014-" (I added the dash just to make sure that only date fields are edited).
    - Save the XML file (maybe under a new name).
    - Go back to the PDF file, and now go to Tools - Forms - More Form Options - Import Data.
    - Select the edited XML file and import it.
    - Done!

Maybe you are looking for