Skip to main content
Inspiring
May 21, 2025
Answered

Nonbreaking space and GREP in UXP

  • May 21, 2025
  • 1 reply
  • 378 views

How to check if a character is a nonbreaking space in UXP?

if (chars[chars.indexOf(char) - 1].contents === " ") {
            console.log("yes");
          }

I can't use \u00A0 or /~S/. The first one doesn't work, the second can't be used in .jsx UXP.

Correct answer Robert at ID-Tasker
quote

Thank You for help.
Correct answer is

if (myCharacter.contents.toString() === "NONBREAKING_SPACE")

By @mateuszp13156491

 

You can save time on converting to string and just compare numeric value:

 

if (myCharacter.contents === 1397645907)
{
    alert("Non Breaking Space")
};

 

1 reply

Community Expert
May 22, 2025
Inspiring
May 22, 2025

Thank You for help.
Correct answer is

if (myCharacter.contents.toString() === "NONBREAKING_SPACE")
Robert at ID-Tasker
Robert at ID-TaskerCorrect answer
Legend
May 22, 2025
quote

Thank You for help.
Correct answer is

if (myCharacter.contents.toString() === "NONBREAKING_SPACE")

By @mateuszp13156491

 

You can save time on converting to string and just compare numeric value:

 

if (myCharacter.contents === 1397645907)
{
    alert("Non Breaking Space")
};