More Regular Expression examples in the Help needed

Ideas for new features

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Aeneas
Posts: 24
Joined: Fri Apr 18, 2008 6:11 am

More Regular Expression examples in the Help needed

Post by Aeneas »

When I need to do Regular Expressions in the find capability,
I would like to see better reminders in the Help of how to perform
certain RE operations. Three in particular:

1) how to match lines which match a string but exclude another string
e.g. match all lines containing string A, but excluding any of those matched lines if they also contain string B,
2) match string "the" but exclude if it is "their"
3) match either "function_A(" or "function_A ("
etc.

Many Internet Search Engines accomplish 1 and 2 with a simple minus (-) syntax.
The Help should also include several Ctrl-R, that is, search and Replace Regular Expression options.
When I remembered how to do this,
search and replace RE's were just as important as search RE's.
RE's are an infrequently used syntax, which can save enormous amounts of search and editing time in unusual situations.
However, it is infrequent enough that users can forget how, without reminders in the Help.
User avatar
jeffy
Posts: 323
Joined: Mon Mar 03, 2003 9:04 am
Location: Philadelphia

Re: More Regular Expression examples in the Help needed

Post by jeffy »

Aeneas wrote:2) match string "the" but exclude if it is "their"
3) match either "function_A(" or "function_A ("
etc.
2) search non-regex whole-word for "the", or regex "\<the\>"
3) Regex: "function_A[ ]{0,1}\("
Kelly
Posts: 34
Joined: Sat May 28, 2011 8:59 am
Location: Ellsworth, ME

Post by Kelly »

Aeneas is lucky he has something to try and remember - quite possibly he's forgotten more than I'll ever know ;)

I came combing through the forum postings hoping to maybe find more in terms of tutorials or other learning tips for regular expressions in TextPad for folks like me that aren't programmers.

Thank you.

Kelly
Kelly
Posts: 34
Joined: Sat May 28, 2011 8:59 am
Location: Ellsworth, ME

Post by Kelly »

This book looks like a handy thing to have on the reference shelf (just ordered it :)

Image
User avatar
jeffy
Posts: 323
Joined: Mon Mar 03, 2003 9:04 am
Location: Philadelphia

Post by jeffy »

*THE* book on regular expressions.
Kelly
Posts: 34
Joined: Sat May 28, 2011 8:59 am
Location: Ellsworth, ME

another resource for newbies to regex

Post by Kelly »

This site is very much worth looking into for interactively learning regex:
http://regexone.com/
Post Reply