Quantcast
Channel: Adobe Community: Message List - FrameMaker Scripting
Viewing all articles
Browse latest Browse all 3715

Finding text with RegEx

$
0
0

I want to create an EScript which converts temporary citations inserted from EndNote by the final citations according to the desired standard. I had done such utilities for FM 7 and 8 (see daube.ch/docu/fmaker41.html). The first step is to collect the temporary citations form the document and write them to a new document which then will be exported as RTF (to be handled by EndNote).

Due to the limitation of Wildcard-search i use RegEx.

tempCit = GetTempCitation ("Hello fans [[Dante, #712]] and another one [[DuçanÌsídõrâ, #312]].");
alert ("tempCit = " + tempCit); 

function GetTempCitation (pgfText) {
     var regex = /(\[\[[^\]]+\]\])/;     var tempCit = "$1";     if (pgfText.search(regex) !== -1) {          return pgfText.replace (regex, tempCit);     } else {     return null;     }
}

Due to lack of documentation (and lack of knowledge) i have modelled this after Rick's "Using a regular expression to convert an image name

to a path":

1) The test script does not return the first occurrence of a temp. citation but the full string. Where is my error?

2) How can i make use of the property (?) rightContext to get the other occurances?

 

Thank You for your help to a newcomer

Klaus


Viewing all articles
Browse latest Browse all 3715

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>