449Re: Search and replace Regular Expression
- Jul 18, 2009--- In firstname.lastname@example.org, "Steve B" <kalukee@...> wrote:
>Try this, should also work from the replace dialog.
> I am a complete greenhorn with reg exp so sorry if this has been answered or its a stupid question.
> I want to replace all occurences of
> LOwerCaseletter^PLOwerCaseletter with
> When i do a save as *.txt of a pdf file the txt shows up as
> This is a really
> really long sentence
> doesnt say
> I want it to say
> This is a really really long sentence that doesnt say much.
^!Replace "(?-i)[a-z]\K\x20*$\R" >> "\x20" RAWS0
(?-i) not case insensitive
[a-z] a character that is in the range of lower case a-z
\K says leave out the part preceding when forming the match that will get replaced (iow, leave the lower case a-z character)
\x20* would match any number (or zero) spaces
$ matches at the end of a line (but consumes no characters)
\R matches the line breaking characters that follow the end of the line
"\x20" is hex for one space.
It is only going to replace any empty spaces and line breaking characters provided that they follow a lower case letter.
Actually to precisely do what you asked could be done with:
^!Replace "(?-i)[a-z]$\K\R([a-z])" >> "\x20$1" RAWS0
Then it doesn't worry about possibly empty spaces at line ends and requires a lower case letter after the line break, which it captures as $1 for the replacement.
>Hmmn, a link that I had for a good tutorial isn't working anymore. I will see if I can find my copy of the file and if so will post it in the files area of this group. However, the most uptodate info on the version of PCRE regex supported by NoteTab is in the regex.chm file in the NoteTab application folder.
> Is there an online tutorial somewhere?
- << Previous post in topic Next post in topic >>