Loading ...
Sorry, an error occurred while loading the content.

Regular Expression Question

Expand Messages
  • james.homme@highmark.com
    Hi, How do I search for a period (.) at the beginning of a line and replace it with an asterisk (*)? I want to replace all of them in a document. Thanks.
    Message 1 of 5 , Aug 9, 2004
    • 0 Attachment
      Hi,
      How do I search for a period (.) at the beginning of a line and replace it
      with an asterisk (*)? I want to replace all of them in a document.

      Thanks.
    • Hugo Paulissen
      ... replace it ... Hello James, You don t need a regular Expression for that. Just look for ^P. (^P stands for paragraph mark) and replace with ^P* . Note:
      Message 2 of 5 , Aug 9, 2004
      • 0 Attachment
        > How do I search for a period (.) at the beginning of a line and
        replace it
        > with an asterisk (*)? I want to replace all of them in a document.

        Hello James,

        You don't need a regular Expression for that. Just look for "^P." (^P
        stands for paragraph mark) and replace with "^P*".

        Note: If the period appears at the beginning of the file you may have
        to replace that manually.

        Help says:
        -------------------------------------------
        The Find and Replace dialog boxes accept tokens to represent special
        characters:
        ^T = Tab ($09)
        ^B = Page break ($0C)
        ^P = Paragraph (carriage-return/line-feed pair)

        The following are not available in NoteTab Pro:
        ^C = Carriage-return ($0D)
        ^L = Line-feed ($0A)
        -------------------------------------------

        Regards,

        Hugo

        Come over to the clips list if you still need that regex ;-)
      • hsavage
        ... James, I struggle with Regexp every time I try to use it in the Find box or in a script. Goto , Help Help Topics Index, scroll down to REGEXP. Help
        Message 3 of 5 , Aug 9, 2004
        • 0 Attachment
          Hugo Paulissen wrote:

          >> How do I search for a period (.) at the beginning of a line and
          >
          > replace it
          >
          >> with an asterisk (*)? I want to replace all of them in a document.
          >
          >
          > Hello James,
          >
          > You don't need a regular Expression for that. Just look for "^P." (^P
          > stands for paragraph mark) and replace with "^P*".
          >
          > Note: If the period appears at the beginning of the file you may have
          > to replace that manually.
          > Regards,
          >
          > Hugo
          >
          > Come over to the clips list if you still need that regex ;-)

          James,

          I struggle with Regexp every time I try to use it in the Find box or in
          a script. 'Goto', Help > Help Topics > Index, scroll down to REGEXP.

          Help indicates, to find matches at the beginning of a line use a leading
          caret.

          Caret (^)
          Matches at the beginning of a line only. A ^ occurring ANYWHERE in the
          match expression (except within a character class) is interpreted in
          this manner. This allows meaningful use of ^ in combination with
          grouping or alternation (see below).

          Help also indicates, match a literal character, enter the character with
          a leading backslash

          Backslash (\)
          Followed by a single character matches that character. For example, '\*'
          matches an asterisk, '\\' matches a backslash, '\$' matches a dollar
          sign, etc.

          To answer your question, I think, you you would use something like the
          following.

          On the Find side use, asterisk\backslash\period; ^\.
          on the Replace side you would
          use only a single asterisk; *

          hrs
        Your message has been successfully submitted and would be delivered to recipients shortly.