how to replace a word to end of line with a blank?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
User avatar
GottaRun
Posts: 4
Joined: Fri Nov 06, 2009 6:30 am
Contact:

how to replace a word to end of line with a blank?

Post by GottaRun »

hi folks,

i want to replace every occurrence of 'high xxxxxx' where x is anything with nothing or a blank. there is other text before the word hight that i want to keep.

is there a website that gives examples of how to find things, and to replace stuff within TextPad?

thank you so much.
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Find what: high .*
Replace with: high

[X] Regular expression

Replace All
Dot (.) matches any single character (except newline). Star (*) is an operator: X* matches any number (possibly zero) of Xs. So .* matches zero or more characters. It matches greedily, that is, it matches as much as possible. So, in this case, it matches to the end of the line.

To help maintain your sanity (although it makes no difference in this case) use Posix regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
There are many regular expression tutorials on the web, and you will find recommendations for some of them if you search this forum.

A standard reference for regular expressions is

Friedl, Jeffrey E F
Mastering Regular Expressions, 3rd ed
O'Reilly, 2006
ISBN: 0-596-52812-4
http://regex.info/

But be aware that the regular expression recogniser used by TextPad is very weak compared with modern tools. So you may get frustrated if you discover a handy trick that works elsewhere but doesn't work in TextPad.

And, of course, there is TextPad's own (rather brief) help, under
Reference Information | Regular Expressions,
Reference Information | Replacement Expressions and
How to... | Find and Replace Text | Use Regular Expressions.
User avatar
GottaRun
Posts: 4
Joined: Fri Nov 06, 2009 6:30 am
Contact:

Post by GottaRun »

thank you.
Post Reply