You can use a text editor (I often use MS Word because it has so many useful features, though it's not really intended for plain text) to find and replace your strings with ID Tagged Text style tags (<ParaStyle:Main> etc.). Before importing the Tagged Text to an ID document, it's best to define those styles you named in your text in the document, so the text will come through looking right. What sometimes helps is to set up a document with the styles you want and some sample text formatted using those styles, then select and export the text as ID Tagged Text (verbose). Open it up in your text editor and copy the whole header section, paste it at the beginning of your text file to be sure the styles are defined correctly.
And choose predefined paragraph or character styles using the MORE OPTIONS button.
It's quite easy to figure out... eventually
$ will search for the end of a paragraph location, but \$ will search for a dollar sign.
So if you did $a then it would find the letter "a" at the end of any paragraph.
But \$ finds that actual symbol.
\w+
that will find any word character, like "a" but if you put the plus sign "+" then it will find any word beginning with "a", like aplhabet, antelope etc.
Similar to the $ sign being used to find characters at the end of paragraphs the "^" starts it's search from just the beginning of a paragraph and nowhere else.
\d will find any digit, but \d+ will find any digit plus any other digits beside it.
So it will find 1 and it will find 100 and 1000 but it won't find 10A0 or 100A0, it will only find 10 and 100, not the letter... or the number after the letter.
So essentially the GREP search ^\$\w+\d+
^ the start of the paragraph
\$ the actual character "$" (not the end of paragraph location)
\w+ any word character plus the rest up to a break, i.e., a space or non-letter word character
\d+ will find any number plus the remaining numbers.
So ^\$\w+\d+ will find the start of the paragraph, the word characters and the digits, and you can choose to select which style you want each to find and replace.
By now you should realise that if you want to search the character "(" then you have to use the "\" and have it phrased like \( in the GREP.
There's loads more to it, but that's the gist of it for now and this particular problem.
I also liked the previous solution by Kathet... nice, but can be problematic. Ms Word is so dodgy, although I've recommended it myself for things that InDesign can't do... so no complaints....
One easy way to find a GREP is to copy the character (hidden or not) out of the document. Open the GREP search and paste it in.
In the Find Text tab, you would search for ^p^p
In the GREP search you would search for \r\r
and replace it with \r\r or leave it blank.
Then, click the more options button, and you can apply character formatting. Click the button to add in what you want to search or replace for, there's two fields, the replace being the latter. From here you can pick a Character Style or Paragraph Style as you can with the normal find/replace feature.
If you search for videos on GREP you will see some great examples and uses of things that you can GREP and how to apply them.
Well it's applying the style to the whole search string...
GREP stands for General Regular Expression Parser
It needs to be able to search Regular Expressions, meaning that it has to be able to find similar text.
So the \r\r above the paragraph you are changing are changing also.
Search for the \r\r with the search including the new paragraph style you just made, and change it back to the one that was on it previous.
One thing I use it for, and I applied this to 3,200 pages of text, and it saved me months of work.
I wanted to change
(i)
(a)
Some paragraph text
to (i) tab here (a) tab here Some paragraph text.
Well the find/replace, you can't find replace wild cards, so where (ii) was and (d) for example occured, I would have to search for them individually.
In GREP I just searched and replaced this
(\(.+\))\r(\(\.+\))\r
And replaced it with this
$1\t$2\t~i
What all that means is
\( would search for a parenthesis, it needs the slash before it to recognise it.
.+ searches for all characters
\) seraches for the close parenthesis
I put them in Parentheis those 3 things inside Parenthesis so it would copy them.
The $1 copies the found text back to where it was
So I also have (a) done that way, \( .+ \) and in parenthesis it looks like (\(.+\)
Then I just removed the \r and replaced them with \t a return for a tab
and the bit at the end ~i, that puts in an indent here character.
So in turn, anywhere that had that
(i)
(a)
Text
changed to (i) tab (a) tab TEXT
What made this more search able was that I had paragraph styles applied, so I only had to go through about 10 pages of text, to come across all the styles, and GREP similar things to change them all across 3,200 pages.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.