Copy link to clipboard
Copied
Hi all,
Is it possibe to find a word, ONLY if it is at the beginning of the line?
Best Regards
Copy link to clipboard
Copied
Hi,
open find window (command/control F), select GREP tab and type:
^yourWord
^ – means shift 6
regards M.
Copy link to clipboard
Copied
Thank you platm72.
Your solution is correct for (Beginning of Paragraph).
The question is about (Beginning of a line).
Regards
Copy link to clipboard
Copied
Not in the user interface itself. The only GREP codes for "beginning of ..." are \A for Beginning of Story and "^" for Beginning of Paragraph and "\<" for Beginning of Word – see also the Online Help at https://helpx.adobe.com/indesign/using/find-change.html#metacharacters_for_searching (actually that list is far from complete as "Beginning of Story" is missing; but there is no hidden "Beginning of Line" code).
It can be scripted, but for a script tailored for your needs we need more information. This quick short one, for example, will search only the first occurrence of a word from the start of a selected story, and I am pretty sure you want more than that.
findText = prompt ("Find", "");
if (findText)
{
app.findGrepPreferences.findWhat = '\\<'+findText+'\\>';
list = app.selection[0].parentStory.findGrep ();
while (list.length)
{
item = list.shift();
if (item.characters[0] == item.lines[0].characters[0])
{
item.select();
exit();
}
}
alert ("Not found");
}
as it will only find the first occurrence of the input word/words at the beginning of a line:
Copy link to clipboard
Copied
Thank you Jongware very much for your details, which showed me that this feature does not exist in InDesign itself.
Your (pretty sure) is (pretty correct). I am looking for a similar of (Find/Change) feature.
Best Regards.
Copy link to clipboard
Copied
Dear Jongware,
I just saw your answer to the "Find a word at the beginning of the line?" problem.
I have the same problem - in Tibetan, the character ། can never be at the beginning of a line (it is kind of comma, period or semicolon) - Tibetan uses hardly any spaces and never one before that character, so non-breaking spaces are not an option.
I tried your script, but could not get it to work (at all somehow). Is there a way to make it generally work to find all instances of a character at the beginning of any line?
Thank you, with kind regards S.J.G.
Copy link to clipboard
Copied
I can't test this, since I don't have a Tibetan font, but you could try a GREP style that applies a No Break Character Style to .།
This should force the ། character to stay with whatever character comes before it.
Copy link to clipboard
Copied
(a some what quite late) Thank you very much. That works very well. (Have to type the Tibetan into the GREP style creation box, just marking and creating a new GREP style does not quite work with Tibetan.)
Find more inspiration, events, and resources on the new Adobe Community
Explore Now