I can't figure out why my GREP won't work.
I want to find any paragraph which starts with zero or more spaces, followed by one or more digits which is followed by any letter. But I only want to select the letter (to check it's formatting and apply paragraph styles accordingly), and not the spaces/digits. However, it seems like I can't use the + and * operators inside a lookbehind function since these searches don't reveal anything.
The following expression works, but it includes the spaces and digits:
And this works but only works for two initial spaces and one digit:
I could manually change the expression to match the four different ways that are needed in my document but I'd prefer it if it can be solved with just one expression.
Lookbehinds have to be of a fixed length, so you cannot use any of the operators +, *, or ?. In addition, behavior with OR strings of different lengths is, well, "undefined" (From memory: I think only the longest string gets considered?)
For a simple query, one or two digits for example, you could use the OR operator like this:
but you are talking about *any* number of spaces followed by *any* number of digits. That's a lot of OR combinations.
.. this works but only works for two initial spaces and one digit:
I could manually change the expression to match the four different ways that are needed in my document ..
If it's just four, are those One or two spaces, one or two digits? That ought to be possible.
Ok, that's good to know. I'll have to use the OR operator then.