[guispeak] Re: Regular expression syntax

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: guispeak@xxxxxxxxxxxxx
  • Date: Sat, 9 Sep 2006 18:24:45 -0400 (EDT)

I think I can help with this one, too.

For the search string, use
 (d+)

For the replacement string, use
\n\1

To explain \d means a digit.  The + sign following means one or more of
them.  The parentheses surrounding them saves the match for later
reference.

In the replacement string, \n refers to a line feed character.
Internally, TextPal uses a line feed rather than a carriage return/line
feed pair for line endings (it simplifies various issues).  The \1 refers
to the first saved match in the search string.  If it contained
additional parenthetical groupings, \2 would also be available, etc.  When
the file is saved to disk, the single line feed endings are converted to
carriage return/line feed pairs.

Jamal
On
Fri, 8 Sep 2006, Donald L. Roberts wrote:

> Date: Fri, 8 Sep 2006 11:09:57 -0700
> From: Donald L. Roberts <donald_roberts_99@xxxxxxxxx>
> Reply-To: guispeak@xxxxxxxxxxxxx
> To: guispeak@xxxxxxxxxxxxx
> Subject: [guispeak] Regular expression syntax
>
> My thanks to Jamal for his prompt response to my initial question
> on this topic and also for placing links to regular expression
> tutorials in the Text Pal help file.  I downloaded one of the
> tutorials; however, it will take many readings and much practice
> for the concepts to soak in.
>
> I have a text document which contains many occurrences of ascii
> 32 followed by combinations of digits.  These combinations vary
> in number of digits from one to three.  I now wish to replace the
> ascii 32 with crlf pairs followed by whatever group of digits was
> there prior to the replacement.  Stated another way, I want to
> replace space followed by a group of digits with crlf followed
> immediately by that same group of digits.
>
> I'll make an honest effort to read the docs and not just come
> here too often with similar questions.
>
> Thanks much for feedback.
>
> Don Roberts
>
>
>
> ** To leave the list, click on the immediately-following link:-
> ** [mailto:guispeak-request@xxxxxxxxxxxxx?subject=unsubscribe]
> ** If this link doesn't work then send a message to:
> ** guispeak-request@xxxxxxxxxxxxx
> ** and in the Subject line type
> ** unsubscribe
> ** For other list commands such as vacation mode, click on the
> ** immediately-following link:-
> ** [mailto:guispeak-request@xxxxxxxxxxxxx?subject=faq]
> ** or send a message, to
> ** guispeak-request@xxxxxxxxxxxxx with the Subject:- faq
>
** To leave the list, click on the immediately-following link:-
** [mailto:guispeak-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** guispeak-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:guispeak-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** guispeak-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: