Jump to content

Script needed for Capital N


Recommended Posts

I need to create a script to find all words that would start with a capital N. For example. Fist Name "Nicole" or Street "1234 Noname street".


I had a font issue occur when sent to PS that the Capital "N" in the name or address fields printed with a capital I with a dot below it.


On output I only want to output these parameters.


Any help is appreciated.



Link to comment
Share on other sites

What exactly are you trying to do with the words that start with a capital "N"?


Are you trying to change to a different font for those letters in a particular field? If so, you can just do something like this:

return ReplaceSubstring(NormalizeEntities(Field("MyFieldName"), "N", '<f name="Arial">N</f>');

I'm assuming here that you really want to replace all instances of the capital letter "N", whether they start a word or not.


If you want to put the entire word in a different font if it starts with a capital "N", you could do something like this:

return NormalizeEntities(Field("MyFieldName")).replace(/(\bN\S*)/g, '<f name="Arial">$1</f>');


If you want to compose only the records where a field value contains a word starting with a capital "N", you can do something like this in your OnRecordStart callback rule:

FusionPro.Composition.composeThisRecord = !!Field("MyFieldName").match(/\bN/);

Or again, if you only care about whether it contains a capital letter "N" anywhere (not just at the start of a word):

FusionPro.Composition.composeThisRecord = Field("MyFieldName").indexOf("N")+1;

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...