Scripting a Search and Replace, but it won't let me use special characters


hi, yall!

 

i'm trying change document index partially complete (i.e., part way through index creation discovered needed add non-breaking space between letters , numbers. found utility lets me directly edit index, won't let me insert non-breaking space.

 

example (original index)

lp 380-5. see gj 1179 b.

lp 380-6. see gj 1179.

lspm j1709+4340. see hip 83945.

ltt 6988. see hip 86057.

ltt 10011. see hip 428.

 

i'm trying insert non-breaking space so: (using underline show want non-breaking space)"

lspm j1709+4340. see hip_83945.

ltt 6988. see hip_86057.

ltt 10011. see hip_428.

 

here's code i'm using:

 

if (topic.name.match(/lspm /) != null) { topic.name = topic.name.replace(/lspm /g, "lspm"\\s); topic.sortorder = topic.sortorder.replace(/lspm /g, "lspm"\\s); counter++; } 

 

i've tried every combination can think of , end variation of:

lspm j1709+4340. see hips83945.

ltt 6988. see hips86057.

ltt 10011. see hips428.

 

or fails run. tried using ~s no luck. tried using \s, nope. tried using \~s, uh-uh. tried using ^s, -- nada. tried leaving off quotes.

what doing wrong? or, better, should use instead?

topic.name = topic.name.replace(/lspm /g, "lspm\u00a0");

topic.sortorder = topic.sortorder.replace(/lspm /g, "lspm\u00a0");

 

hth

 

trevor



More discussions in InDesign Scripting


adobe

Comments

Popular posts from this blog

Reader DC

AdobeIDの作り方

Adobe InDesign CC 2017 has stopped working