Page 1 of 1

Find lines that begin with certain string/words

Posted: Fri Aug 30, 2013 2:01 pm
by elcaro
Using Textpad 7.0.9 (32-bit)

I want to find lines that begin with certain string/words. There might be white spaces or tabs before that string but nothing else. Basically if that lines begins with that string, I want to find it. I thought '^' will work, but it didn't :-(

Posted: Fri Aug 30, 2013 4:01 pm
by ben_josephs
Search | Find... (<F8>):
Find what: ^\h*Your string

[X] Regular expression
But if Your string contains special characters, such as \, (, ), [, ], {, }, *, +, you'll have to either quote those special characters individually using backslashes or square brackets, or quote the whole string with \Q...\E, like this:

^\h*\QYour string containing special characters: ( [ { \ * + } ] )\E

Posted: Fri Aug 30, 2013 4:27 pm
by elcaro
Thanks much ben_josephs!

Would \h take care of tabs too?

Posted: Fri Aug 30, 2013 4:44 pm
by ben_josephs
In TextPad's help, in the section Reference Information | Regular Expressions, in the table under the heading "Single character" character classes, is this entry:
\h ... Horizontal whitespace

Posted: Fri Aug 30, 2013 5:18 pm
by elcaro
Thanks again ben_josephs!