Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

End of story

Explorer ,
Apr 27, 2018 Apr 27, 2018

Copy link to clipboard

Copied

Hello all. I have a finnicky problem whereby I've created a script to clean up some text and the result is that in some instances I end up with a blank space preceding the end of story. I wish to find this blank space and delete it. The problem is in identifying the end of story, which you all know is the hashtag symbol. But of course you can't search a hashtag. I've tried \$, but that doesn't work because there are multiple elements selected and it only does the last one. I've tried \n, but that doesn't work. I've tried \r but that doesn't seem to work either.

Any thoughts?

Marcrest

TOPICS
Scripting

Views

642
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Apr 29, 2018 Apr 29, 2018

Je verrais plutôt ça.

var searchStr = /\s+$/gi;

var aCon = app.activeDocument.textFrames[0].contents.replace (searchStr, '');

app.activeDocument.textFrames[0].contents = aCon;

LR

Votes

Translate
Adobe
Community Expert ,
Apr 27, 2018 Apr 27, 2018

Copy link to clipboard

Copied

Hi lMarcrest

give this a try

// required: one textFrame with space(s) at the end

var searchStr = /\u0020+$/gi;

var aCon = app.activeDocument.textFrames[0].contents.replace (searchStr, '');

app.activeDocument.textFrames[0].contents = aCon;

Have fun

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Apr 29, 2018 Apr 29, 2018

Copy link to clipboard

Copied

Je verrais plutôt ça.

var searchStr = /\s+$/gi;

var aCon = app.activeDocument.textFrames[0].contents.replace (searchStr, '');

app.activeDocument.textFrames[0].contents = aCon;

LR

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 29, 2018 Apr 29, 2018

Copy link to clipboard

Copied

Yes, maybe.

But I don't know what lMarcrest​ really want.

But be sure \s is the same as [\u0020\t\n\r]

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 03, 2018 May 03, 2018

Copy link to clipboard

Copied

LATEST

lMarcrest schrieb

… in some instances I end up with a blank space preceding the end of story. I wish to find this blank space and delete it …

https://forums.adobe.com/people/pixxxel+schubser  schrieb

Yes, maybe.

But I don't know what lMarcrest  really want.

But be sure \s is the same as [\u0020\t\n\r]

Hahaha.

you mean empty paragraphs - and not spaces.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 03, 2018 May 03, 2018

Copy link to clipboard

Copied

Winner, winner, chicken dinner. This "/^\s+/" along with" /\s+$/" was what I ended up with. It searches both the beginning of a text box in addition to the end of a text box, for blank spaces.

Thank you @renél80416020 for leading me in the right direction : )

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines