4 Replies Latest reply on Sep 18, 2016 9:20 PM by natrev

    Help need for Find and replace grep using in Xml tags!

    natrev Level 3

      Hi Everyone,

       

      I have a Textframe with value ($00.00) between two xml tags. one tag for "$" and another one for value(00.00).

      Now I need find those value (00.00) and replace value(24.10). If I run the script, Its remove the price XML tag and updated the price.

      My expectation is update theose value without removing the XML tag.

      Please suggest me where I did the mistake in the code. Kindly find the screen shot and code for your reference.

       

           Before run the Script:                                                                                                               After Run the Script:

      Screen Shot 2016-09-17 at 5.03.18 pm.png Screen Shot 2016-09-17 at 5.09.31 pm.png

      Code:

      var flgGREP="[$]\\d+[.]\\d+"
      var Price="$24.10"
      myLine=app.selection[0];
      FindReplaceValue(flgGREP,Price,myLine);
      function FindReplaceValue(findValue,replaceValue,Sapps){
          app.findGrepPreferences = app.changeGrepPreferences = null;  
          app.findGrepPreferences.findWhat = findValue;  
          app.changeGrepPreferences.changeTo = replaceValue;
          Sapps.changeGrep(); 
      }
      

       

      -yajiv