Reply To: Literal Period (.) Find Between

#63356

To get a single backslash in this editor you have to type two: \ (and thus I actually had to type this '' to make 'em both show up :) )

Back to your problem. Your GREP query works fine; it will accurately find the period inside “itle:(en-dash).(return)”. The problem is, you have some more text between your 'title' and that period — your 'bunch of characters' — and you forgot to include those in your search.

So you need to add a wildcard match to skip the actual title data. One would assume this to work:

(?<=itle:~>.+).(?=~b)

but it doesn't: a Lookbehind needs to have a fixed length, you cannot use any of the variable length specifiers (the '+' here). Most dialects of GREP do not support variable length lookbehinds — things get too fast too complicated if this is allowed.

So a workaround is needed here: find “Title”, sentence, period, and replace with just “Title” and sentence.

[ A propos, a better way of testing for 'end of paragraph' is to use the end-of-paragraph specifier '$'. Your '~b' matches the hard return at the end, and so you had to find a way to preserve it. The '$' on the other hand matches end-of-paragraph without 'selecting' the next hard return. ]

This ought to work: search for

(itle:~>.+).$

and replace with

$1

This article was last modified on October 15, 2012

Comments (0)

Loading comments...