Hello All,

I am editing a flat file in WordPad. Is there a way to replace the "~" with a carriage return or line feed? Once I do a replace all do I need to save the file in a different format? Should I use some other editor, Context , notepad?


add a comment

5 Answers

  • Votes
  • Oldest
  • Latest

I use Textpad for this kind of tasks since it can search and replace using regular expresions. Check it out, they have a trial version.

add a comment

What do i need to replace the "~" with to get a carriage return?

add a comment

What do i need to replace the "~" with to get a carriage return?

Install TextPad then read this

A regular expression (RE) is a search string that uses special characters to match patterns of text. You can use them with the Find, and Find in Files commands, and with the Replace command in conjunction with replacement expressions. TextPad's regular expressions are based on POSIX standard P1003.2, but the syntax can be that of POSIX, or UNIX extended regular expressions (the default). The choice can be made on the Editor page of the Preferences dialog box.

To use a regular expression:
From the Search menu, choose Find, Replace, or Find in Files.
In the Find What box, type a regular expression.
Check the "Regular expression" box.
Summary of regular expressions:
Default Operator: POSIX Operator: Description:
. . Any single character. Example: h.t matches hat, hit, hot and hut.
[ ] [ ] Any one of the characters in the brackets, or any of a range of characters separated by a hyphen (-), or a character class operator (see below). Examples: h[aeiou][a-z] matches hat, hip, hit, hop, and hut; [A-Za-z] matches any single letter; x[0-9] matches x0, x1, …, x9.
[^] [^] Any characters except for those after the caret "^". Example: h[^u]t matches hat, hit, and hot, but not hut.
^ ^ The start of a line (column 1).
$ $ The end of a line (not the line break characters). Use this for restricting matches to characters at the end of a line. Example: end$ only matches "end" when it's the last word on a line, and ^end only matches "end" when it's the first word on a line.
< < The start of a word.
> > The end of a word.
\t \t The tab character.
\f \f The page break (form feed) character.
\n \n A new line character, for matching expressions that span line boundaries. This cannot be followed by operators '*', '+' or {}. Do not use this for constraining matches to the end of a line. It's much more efficient to use "$".
\xdd \xdd "dd" is the two-digit hexadecimal code for any character.
( ) ( ) Groups a tagged expression to use in replacement expressions. An RE can have up to 9 tagged expressions, numbered according to their order in the RE. The corresponding replacement expression is \x, for x in the range 1-9. Example: If ([a-z]+) ([a-z]+) matches "way wrong", \2 \1 would replace it with "wrong way".

    • Matches zero or more of the preceding characters or expressions. Example: ho*p matches hp, hop and hoop.
      ? ? Matches zero or one of the preceding characters or expressions. Example: ho?p matches hp, and hop, but not hoop.
        • Matches one or more of the preceding characters or expressions. Example: ho+p matches hop, and hoop, but not hp.
          {count} {count} Matches the specified number of the preceding characters or expressions. Example: ho{2}p matches hoop, but not hop.
          {min,} {min,} Matches at least the specified number of the preceding characters or expressions. Example: ho{1,}p matches hop and hoop, but not hp.
          {min,max} {min,max} Matches between min and max of the preceding characters or expressions. Example: ho{1,2}p matches hop and hoop, but not hp or hooop.
          | | Matches either the expression to its left or its right. Example: hop|hoop matches hop, or hoop.
          \ \ "Escapes" the special meaning of the above expressions, so that they can be matched as literal characters. Hence, to match a literal "", you must use "". Example: < matches the start of a word, but \< matches "<".

Character Class Operators "[: ... :]":
These can be used in class expressions as an alternative way of representing classes of characters. For example, [a-z0-9] is equivalent to [[:lower:][:digit:]]. (Note the extra pairs of brackets.) The defined classes are:

Expression: Description:
[:alpha:] Any letter.
[:lower:] Any lower case letter.
[:upper:] Any upper case letter.
[:alnum:] Any digit or letter.
[:digit:] Any digit.
[:xdigit:] Any hexadecimal digit (0-9, a-f or A-F).
[:blank:] Space or tab.
[:space:] Space, tab, vertical tab, return, line feed, form feed.
[:cntrl:] Control characters (Delete and ASCII codes less than space).
[:print:] Printable characters, including space.
[:graph:] Printable characters, excluding space.
[:punct:] Anything that is not a control or alphanumeric character.
[:word:] Letters, hypens and apostrophes.
[:token:] Any of the characters defined on the Syntax page for the document class, or in the syntax definition file if syntax highlighting is enabled for the document class.

HTML tags are in matched pairs of <…>, such as <FONT SIZE=+1>. To match any tag that begins and ends on the same line, use the regular expression:


This matches a "<", followed by zero or more characters, excluding ">", followed by a ">". Note that "*" finds the longest matching sequence on a line, so the regular expression:


would be incorrect, because it would not stop at the first ">", if there was more than one on the line.

For more information and examples, see regular expressions, and replacement expressions in the Reference section.

add a comment

Thanks al for your help. TextPad works great. That checkbox for regular expression worked just fine.

Merry Christmas All!

add a comment