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
1 Correct answer
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
Explore related tutorials & articles
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
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
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]
Copy link to clipboard
Copied
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.
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 : )

