Skip to main content
Inspiring
January 14, 2011
Answered

Regexp for removing object character code? [JS CS4]

  • January 14, 2011
  • 2 replies
  • 6275 views

I've got a routine that makes a list of headlines & sorts them, which ends up as bookmarks. When a headline contains an anchored object, the resulting text includes a glyph, a tiny dotted box with 'OBJ' in it, which looks bad in the final list of bookmarks. Using string.charAt(x) for the character returns 65532.

I suppose I could write a function that loops through the sentence's characters & discards any 65532, but that seems like overkill if there's a regexp replace string. I already run string.replace(/\s+/g, " ") to replace non-space invisible ctrl characters w/space, but that pattern doesn't affect the object character. Does this ring a bell with anyone?

Thanks.

Correct answer

It's the "Anchored object marker" (InDesign name) or "Object replacement character" (Unicode name) . 65532 in hexadecimal is FFFC, so in java/javascript unicode notation it is "\uFFFC".

myString = myString.replace(/\uFFFC/,"");

You can use this to find the hexadecimal unicode value of a character:

myString.charCodeAt(myIndex).toString(16)

2 replies

Participant
January 5, 2025

what is my error in passwords 

James Gifford—NitroPress
Legend
January 5, 2025

This is a user-to-user help forum. For anything to do with your Adobe licensing, subscription or account you need to contact Adobe technical support in your country or region.

Correct answer
January 14, 2011

It's the "Anchored object marker" (InDesign name) or "Object replacement character" (Unicode name) . 65532 in hexadecimal is FFFC, so in java/javascript unicode notation it is "\uFFFC".

myString = myString.replace(/\uFFFC/,"");

You can use this to find the hexadecimal unicode value of a character:

myString.charCodeAt(myIndex).toString(16)
dsackettAuthor
Inspiring
January 15, 2011

Awesome, Haakenlid, thank you so much! The snippet worked like a charm.

And I really appreciate having a method for discovering the hex for unicode of any character.

Thanks again.

Inspiring
January 15, 2011

... I really appreciate having a method for discovering the hex for unicode of any character.

If the character is somewhere in your text, all you have to do is select just this character and look in the Info panel.