4 Replies Latest reply on Jul 27, 2011 11:34 AM by John Hawkinson

    grep troubles


      I try to apply character style with grep via script. I have a textframe with text shown below:


      Iquatusdae quiberum, sitatem pellabo reriatio que volupta temolestrum exerovi delesseque omniate nonecta turitia diti arum venis am as minim am ut exces rem <b>blabla</b> quo offici dolupta tureperum ipsus dolor aut assus, ipient laudae coreictati volecest aut aditium nonsed ut etur sam nimporestem www.facebook.com et velit aut offictas res inctotat etur, soluptat la velest am imporemporem serioreicte reped quo ma



      if I run script below (textframe is selected at start and character syle "bold" does exists!) everything is OK, string <b>blabla</b> is formated as I want!


          app.findGrepPreferences = NothingEnum.nothing;
          app.changeGrepPreferences = NothingEnum.nothing;
          app.findChangeGrepOptions.includeFootnotes = false;
          app.findChangeGrepOptions.includeHiddenLayers = false;
          app.findChangeGrepOptions.includeLockedLayersForFind = false;
          app.findChangeGrepOptions.includeLockedStoriesForFind = false;
          app.findChangeGrepOptions.includeMasterPages = false;
          app.findGrepPreferences.findWhat = "(?s)<b>(.+?)</b>";
          app.changeGrepPreferences.appliedCharacterStyle =app.activeDocument.characterStyles.item("bold") ;
          app.findGrepPreferences = NothingEnum.nothing;
          app.changeGrepPreferences = NothingEnum.nothing;



      But if I use expression w{3}.?\S+|http://.+\S+ which should find some urls and apply character style "bold" nothing happens. Expression is not perfect for searching all urls but it works if i use Find/Change in application.