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.
how to replace a word to end of line with a blank?
Moderators: AmigoJack, bbadmin, helios, MudGuard
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
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.Find what: high .*
Replace with: high
[X] Regular expression
Replace All
To help maintain your sanity (although it makes no difference in this case) 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.Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
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.